feat: add batch upsert tags

This commit is contained in:
Steven 2024-02-01 21:13:42 +08:00
parent fdd17ce849
commit dd06278692
13 changed files with 561 additions and 219 deletions

View File

@ -585,6 +585,16 @@ ExportMemos exports memos.
| 200 | A successful response. | [v2GetTagSuggestionsResponse](#v2gettagsuggestionsresponse) |
| default | An unexpected error response. | [googlerpcStatus](#googlerpcstatus) |
### /api/v2/tags:batchUpsert
#### POST
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. | [v2BatchUpsertTagResponse](#v2batchupserttagresponse) |
| default | An unexpected error response. | [googlerpcStatus](#googlerpcstatus) |
### /api/v2/tags:rename
#### PATCH
@ -1033,6 +1043,12 @@ CreateUser creates a new user.
| createTime | dateTime | | No |
| payload | [apiv2ActivityPayload](#apiv2activitypayload) | | No |
#### v2BatchUpsertTagResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| v2BatchUpsertTagResponse | object | | |
#### v2CreateMemoCommentResponse
| Name | Type | Description | Required |
@ -1425,6 +1441,12 @@ CreateUser creates a new user.
| ---- | ---- | ----------- | -------- |
| workspaceProfile | [v2WorkspaceProfile](#v2workspaceprofile) | | No |
#### v2UpsertTagRequest
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| name | string | | No |
#### v2UpsertTagResponse
| Name | Type | Description | Required |

View File

@ -736,6 +736,20 @@ paths:
type: string
tags:
- TagService
/api/v2/tags:batchUpsert:
post:
operationId: TagService_BatchUpsertTag
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/v2BatchUpsertTagResponse'
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
tags:
- TagService
/api/v2/tags:rename:
patch:
operationId: TagService_RenameTag
@ -1416,6 +1430,8 @@ definitions:
format: date-time
payload:
$ref: '#/definitions/apiv2ActivityPayload'
v2BatchUpsertTagResponse:
type: object
v2CreateMemoCommentResponse:
type: object
properties:
@ -1836,6 +1852,11 @@ definitions:
properties:
workspaceProfile:
$ref: '#/definitions/v2WorkspaceProfile'
v2UpsertTagRequest:
type: object
properties:
name:
type: string
v2UpsertTagResponse:
type: object
properties:

View File

@ -11,9 +11,6 @@ import (
"github.com/google/cel-go/cel"
"github.com/lithammer/shortuuid/v4"
"github.com/pkg/errors"
"github.com/yourselfhosted/gomark/ast"
"github.com/yourselfhosted/gomark/parser"
"github.com/yourselfhosted/gomark/parser/tokenizer"
"go.uber.org/zap"
expr "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
"google.golang.org/grpc/codes"
@ -48,11 +45,6 @@ func (s *APIV2Service) CreateMemo(ctx context.Context, request *apiv2pb.CreateMe
return nil, status.Errorf(codes.InvalidArgument, "content too long")
}
nodes, err := parser.Parse(tokenizer.Tokenize(request.Content))
if err != nil {
return nil, errors.Wrap(err, "failed to parse memo content")
}
create := &store.Memo{
ResourceName: shortuuid.New(),
CreatorID: user.ID,
@ -74,18 +66,6 @@ func (s *APIV2Service) CreateMemo(ctx context.Context, request *apiv2pb.CreateMe
}
metric.Enqueue("memo create")
// Dynamically upsert tags from memo content.
traverseASTNodes(nodes, func(node ast.Node) {
if tag, ok := node.(*ast.Tag); ok {
if _, err := s.Store.UpsertTag(ctx, &store.Tag{
Name: tag.Content,
CreatorID: user.ID,
}); err != nil {
log.Warn("Failed to create tag", zap.Error(err))
}
}
})
memoMessage, err := s.convertMemoFromStore(ctx, memo)
if err != nil {
return nil, errors.Wrap(err, "failed to convert memo")
@ -250,22 +230,6 @@ func (s *APIV2Service) UpdateMemo(ctx context.Context, request *apiv2pb.UpdateMe
for _, path := range request.UpdateMask.Paths {
if path == "content" {
update.Content = &request.Memo.Content
nodes, err := parser.Parse(tokenizer.Tokenize(*update.Content))
if err != nil {
return nil, errors.Wrap(err, "failed to parse memo content")
}
// Dynamically upsert tags from memo content.
traverseASTNodes(nodes, func(node ast.Node) {
if tag, ok := node.(*ast.Tag); ok {
if _, err := s.Store.UpsertTag(ctx, &store.Tag{
Name: tag.Content,
CreatorID: user.ID,
}); err != nil {
log.Warn("Failed to create tag", zap.Error(err))
}
}
})
} else if path == "resource_name" {
update.ResourceName = &request.Memo.Name
if !util.ResourceNameMatcher.MatchString(*update.ResourceName) {

View File

@ -1,27 +0,0 @@
package v2
import (
"github.com/yourselfhosted/gomark/ast"
)
func traverseASTNodes(nodes []ast.Node, fn func(ast.Node)) {
for _, node := range nodes {
fn(node)
switch n := node.(type) {
case *ast.Paragraph:
traverseASTNodes(n.Children, fn)
case *ast.Heading:
traverseASTNodes(n.Children, fn)
case *ast.Blockquote:
traverseASTNodes(n.Children, fn)
case *ast.OrderedList:
traverseASTNodes(n.Children, fn)
case *ast.UnorderedList:
traverseASTNodes(n.Children, fn)
case *ast.TaskList:
traverseASTNodes(n.Children, fn)
case *ast.Bold:
traverseASTNodes(n.Children, fn)
}
}
}

View File

@ -3,7 +3,7 @@ package v2
import (
"context"
"fmt"
"regexp"
"slices"
"sort"
"github.com/pkg/errors"
@ -11,7 +11,6 @@ import (
"github.com/yourselfhosted/gomark/parser"
"github.com/yourselfhosted/gomark/parser/tokenizer"
"github.com/yourselfhosted/gomark/restore"
"golang.org/x/exp/slices"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@ -42,6 +41,15 @@ func (s *APIV2Service) UpsertTag(ctx context.Context, request *apiv2pb.UpsertTag
}, nil
}
func (s *APIV2Service) BatchUpsertTag(ctx context.Context, request *apiv2pb.BatchUpsertTagRequest) (*apiv2pb.BatchUpsertTagResponse, error) {
for _, r := range request.Requests {
if _, err := s.UpsertTag(ctx, r); err != nil {
return nil, status.Errorf(codes.Internal, "failed to batch upsert tags: %v", err)
}
}
return &apiv2pb.BatchUpsertTagResponse{}, nil
}
func (s *APIV2Service) ListTags(ctx context.Context, request *apiv2pb.ListTagsRequest) (*apiv2pb.ListTagsResponse, error) {
username, err := ExtractUsernameFromName(request.User)
if err != nil {
@ -183,7 +191,7 @@ func (s *APIV2Service) GetTagSuggestions(ctx context.Context, request *apiv2pb.G
ContentSearch: []string{"#"},
RowStatus: &normalRowStatus,
}
memoList, err := s.Store.ListMemos(ctx, memoFind)
memos, err := s.Store.ListMemos(ctx, memoFind)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to list memos: %v", err)
}
@ -200,12 +208,21 @@ func (s *APIV2Service) GetTagSuggestions(ctx context.Context, request *apiv2pb.G
tagNameList = append(tagNameList, tag.Name)
}
tagMapSet := make(map[string]bool)
for _, memo := range memoList {
for _, tag := range findTagListFromMemoContent(memo.Content) {
if !slices.Contains(tagNameList, tag) {
tagMapSet[tag] = true
}
for _, memo := range memos {
nodes, err := parser.Parse(tokenizer.Tokenize(memo.Content))
if err != nil {
return nil, errors.Wrap(err, "failed to parse memo content")
}
// Dynamically upsert tags from memo content.
traverseASTNodes(nodes, func(node ast.Node) {
if tagNode, ok := node.(*ast.Tag); ok {
tag := tagNode.Content
if !slices.Contains(tagNameList, tag) {
tagMapSet[tag] = true
}
}
})
}
suggestions := []string{}
for tag := range tagMapSet {
@ -231,20 +248,24 @@ func (s *APIV2Service) convertTagFromStore(ctx context.Context, tag *store.Tag)
}, nil
}
var tagRegexp = regexp.MustCompile(`#([^\s#,]+)`)
func findTagListFromMemoContent(memoContent string) []string {
tagMapSet := make(map[string]bool)
matches := tagRegexp.FindAllStringSubmatch(memoContent, -1)
for _, v := range matches {
tagName := v[1]
tagMapSet[tagName] = true
func traverseASTNodes(nodes []ast.Node, fn func(ast.Node)) {
for _, node := range nodes {
fn(node)
switch n := node.(type) {
case *ast.Paragraph:
traverseASTNodes(n.Children, fn)
case *ast.Heading:
traverseASTNodes(n.Children, fn)
case *ast.Blockquote:
traverseASTNodes(n.Children, fn)
case *ast.OrderedList:
traverseASTNodes(n.Children, fn)
case *ast.UnorderedList:
traverseASTNodes(n.Children, fn)
case *ast.TaskList:
traverseASTNodes(n.Children, fn)
case *ast.Bold:
traverseASTNodes(n.Children, fn)
}
}
tagList := []string{}
for tag := range tagMapSet {
tagList = append(tagList, tag)
}
sort.Strings(tagList)
return tagList
}

View File

@ -10,6 +10,9 @@ service TagService {
rpc UpsertTag(UpsertTagRequest) returns (UpsertTagResponse) {
option (google.api.http) = {post: "/api/v2/tags"};
}
rpc BatchUpsertTag(BatchUpsertTagRequest) returns (BatchUpsertTagResponse) {
option (google.api.http) = {post: "/api/v2/tags:batchUpsert"};
}
rpc ListTags(ListTagsRequest) returns (ListTagsResponse) {
option (google.api.http) = {get: "/api/v2/tags"};
}
@ -39,6 +42,13 @@ message UpsertTagResponse {
Tag tag = 1;
}
message BatchUpsertTagRequest {
repeated UpsertTagRequest requests = 1;
}
message BatchUpsertTagResponse {
}
message ListTagsRequest {
// The creator of tags.
// Format: users/{username}

View File

@ -134,6 +134,8 @@
- [MemoService](#memos-api-v2-MemoService)
- [api/v2/tag_service.proto](#api_v2_tag_service-proto)
- [BatchUpsertTagRequest](#memos-api-v2-BatchUpsertTagRequest)
- [BatchUpsertTagResponse](#memos-api-v2-BatchUpsertTagResponse)
- [DeleteTagRequest](#memos-api-v2-DeleteTagRequest)
- [DeleteTagResponse](#memos-api-v2-DeleteTagResponse)
- [GetTagSuggestionsRequest](#memos-api-v2-GetTagSuggestionsRequest)
@ -1869,6 +1871,31 @@ Used internally for obfuscating the page token.
<a name="memos-api-v2-BatchUpsertTagRequest"></a>
### BatchUpsertTagRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| requests | [UpsertTagRequest](#memos-api-v2-UpsertTagRequest) | repeated | |
<a name="memos-api-v2-BatchUpsertTagResponse"></a>
### BatchUpsertTagResponse
<a name="memos-api-v2-DeleteTagRequest"></a>
### DeleteTagRequest
@ -2046,6 +2073,7 @@ Used internally for obfuscating the page token.
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
| UpsertTag | [UpsertTagRequest](#memos-api-v2-UpsertTagRequest) | [UpsertTagResponse](#memos-api-v2-UpsertTagResponse) | |
| BatchUpsertTag | [BatchUpsertTagRequest](#memos-api-v2-BatchUpsertTagRequest) | [BatchUpsertTagResponse](#memos-api-v2-BatchUpsertTagResponse) | |
| ListTags | [ListTagsRequest](#memos-api-v2-ListTagsRequest) | [ListTagsResponse](#memos-api-v2-ListTagsResponse) | |
| RenameTag | [RenameTagRequest](#memos-api-v2-RenameTagRequest) | [RenameTagResponse](#memos-api-v2-RenameTagResponse) | |
| DeleteTag | [DeleteTagRequest](#memos-api-v2-DeleteTagRequest) | [DeleteTagResponse](#memos-api-v2-DeleteTagResponse) | |

View File

@ -172,6 +172,91 @@ func (x *UpsertTagResponse) GetTag() *Tag {
return nil
}
type BatchUpsertTagRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Requests []*UpsertTagRequest `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests,omitempty"`
}
func (x *BatchUpsertTagRequest) Reset() {
*x = BatchUpsertTagRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v2_tag_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BatchUpsertTagRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BatchUpsertTagRequest) ProtoMessage() {}
func (x *BatchUpsertTagRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_tag_service_proto_msgTypes[3]
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 BatchUpsertTagRequest.ProtoReflect.Descriptor instead.
func (*BatchUpsertTagRequest) Descriptor() ([]byte, []int) {
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{3}
}
func (x *BatchUpsertTagRequest) GetRequests() []*UpsertTagRequest {
if x != nil {
return x.Requests
}
return nil
}
type BatchUpsertTagResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *BatchUpsertTagResponse) Reset() {
*x = BatchUpsertTagResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v2_tag_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BatchUpsertTagResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BatchUpsertTagResponse) ProtoMessage() {}
func (x *BatchUpsertTagResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_tag_service_proto_msgTypes[4]
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 BatchUpsertTagResponse.ProtoReflect.Descriptor instead.
func (*BatchUpsertTagResponse) Descriptor() ([]byte, []int) {
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{4}
}
type ListTagsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -185,7 +270,7 @@ type ListTagsRequest struct {
func (x *ListTagsRequest) Reset() {
*x = ListTagsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v2_tag_service_proto_msgTypes[3]
mi := &file_api_v2_tag_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -198,7 +283,7 @@ func (x *ListTagsRequest) String() string {
func (*ListTagsRequest) ProtoMessage() {}
func (x *ListTagsRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_tag_service_proto_msgTypes[3]
mi := &file_api_v2_tag_service_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -211,7 +296,7 @@ func (x *ListTagsRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListTagsRequest.ProtoReflect.Descriptor instead.
func (*ListTagsRequest) Descriptor() ([]byte, []int) {
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{3}
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{5}
}
func (x *ListTagsRequest) GetUser() string {
@ -232,7 +317,7 @@ type ListTagsResponse struct {
func (x *ListTagsResponse) Reset() {
*x = ListTagsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v2_tag_service_proto_msgTypes[4]
mi := &file_api_v2_tag_service_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -245,7 +330,7 @@ func (x *ListTagsResponse) String() string {
func (*ListTagsResponse) ProtoMessage() {}
func (x *ListTagsResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_tag_service_proto_msgTypes[4]
mi := &file_api_v2_tag_service_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -258,7 +343,7 @@ func (x *ListTagsResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListTagsResponse.ProtoReflect.Descriptor instead.
func (*ListTagsResponse) Descriptor() ([]byte, []int) {
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{4}
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{6}
}
func (x *ListTagsResponse) GetTags() []*Tag {
@ -283,7 +368,7 @@ type RenameTagRequest struct {
func (x *RenameTagRequest) Reset() {
*x = RenameTagRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v2_tag_service_proto_msgTypes[5]
mi := &file_api_v2_tag_service_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -296,7 +381,7 @@ func (x *RenameTagRequest) String() string {
func (*RenameTagRequest) ProtoMessage() {}
func (x *RenameTagRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_tag_service_proto_msgTypes[5]
mi := &file_api_v2_tag_service_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -309,7 +394,7 @@ func (x *RenameTagRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use RenameTagRequest.ProtoReflect.Descriptor instead.
func (*RenameTagRequest) Descriptor() ([]byte, []int) {
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{5}
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{7}
}
func (x *RenameTagRequest) GetUser() string {
@ -344,7 +429,7 @@ type RenameTagResponse struct {
func (x *RenameTagResponse) Reset() {
*x = RenameTagResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v2_tag_service_proto_msgTypes[6]
mi := &file_api_v2_tag_service_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -357,7 +442,7 @@ func (x *RenameTagResponse) String() string {
func (*RenameTagResponse) ProtoMessage() {}
func (x *RenameTagResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_tag_service_proto_msgTypes[6]
mi := &file_api_v2_tag_service_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -370,7 +455,7 @@ func (x *RenameTagResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use RenameTagResponse.ProtoReflect.Descriptor instead.
func (*RenameTagResponse) Descriptor() ([]byte, []int) {
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{6}
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{8}
}
func (x *RenameTagResponse) GetTag() *Tag {
@ -391,7 +476,7 @@ type DeleteTagRequest struct {
func (x *DeleteTagRequest) Reset() {
*x = DeleteTagRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v2_tag_service_proto_msgTypes[7]
mi := &file_api_v2_tag_service_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -404,7 +489,7 @@ func (x *DeleteTagRequest) String() string {
func (*DeleteTagRequest) ProtoMessage() {}
func (x *DeleteTagRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_tag_service_proto_msgTypes[7]
mi := &file_api_v2_tag_service_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -417,7 +502,7 @@ func (x *DeleteTagRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteTagRequest.ProtoReflect.Descriptor instead.
func (*DeleteTagRequest) Descriptor() ([]byte, []int) {
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{7}
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{9}
}
func (x *DeleteTagRequest) GetTag() *Tag {
@ -436,7 +521,7 @@ type DeleteTagResponse struct {
func (x *DeleteTagResponse) Reset() {
*x = DeleteTagResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v2_tag_service_proto_msgTypes[8]
mi := &file_api_v2_tag_service_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -449,7 +534,7 @@ func (x *DeleteTagResponse) String() string {
func (*DeleteTagResponse) ProtoMessage() {}
func (x *DeleteTagResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_tag_service_proto_msgTypes[8]
mi := &file_api_v2_tag_service_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -462,7 +547,7 @@ func (x *DeleteTagResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteTagResponse.ProtoReflect.Descriptor instead.
func (*DeleteTagResponse) Descriptor() ([]byte, []int) {
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{8}
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{10}
}
type GetTagSuggestionsRequest struct {
@ -478,7 +563,7 @@ type GetTagSuggestionsRequest struct {
func (x *GetTagSuggestionsRequest) Reset() {
*x = GetTagSuggestionsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v2_tag_service_proto_msgTypes[9]
mi := &file_api_v2_tag_service_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -491,7 +576,7 @@ func (x *GetTagSuggestionsRequest) String() string {
func (*GetTagSuggestionsRequest) ProtoMessage() {}
func (x *GetTagSuggestionsRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_tag_service_proto_msgTypes[9]
mi := &file_api_v2_tag_service_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -504,7 +589,7 @@ func (x *GetTagSuggestionsRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetTagSuggestionsRequest.ProtoReflect.Descriptor instead.
func (*GetTagSuggestionsRequest) Descriptor() ([]byte, []int) {
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{9}
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{11}
}
func (x *GetTagSuggestionsRequest) GetUser() string {
@ -525,7 +610,7 @@ type GetTagSuggestionsResponse struct {
func (x *GetTagSuggestionsResponse) Reset() {
*x = GetTagSuggestionsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v2_tag_service_proto_msgTypes[10]
mi := &file_api_v2_tag_service_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -538,7 +623,7 @@ func (x *GetTagSuggestionsResponse) String() string {
func (*GetTagSuggestionsResponse) ProtoMessage() {}
func (x *GetTagSuggestionsResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_tag_service_proto_msgTypes[10]
mi := &file_api_v2_tag_service_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -551,7 +636,7 @@ func (x *GetTagSuggestionsResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetTagSuggestionsResponse.ProtoReflect.Descriptor instead.
func (*GetTagSuggestionsResponse) Descriptor() ([]byte, []int) {
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{10}
return file_api_v2_tag_service_proto_rawDescGZIP(), []int{12}
}
func (x *GetTagSuggestionsResponse) GetTags() []string {
@ -577,80 +662,95 @@ var file_api_v2_tag_service_proto_rawDesc = []byte{
0x61, 0x6d, 0x65, 0x22, 0x38, 0x0a, 0x11, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x54, 0x61, 0x67,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x03, 0x74, 0x61, 0x67, 0x22, 0x25, 0x0a,
0x0f, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x03, 0x74, 0x61, 0x67, 0x22, 0x53, 0x0a,
0x15, 0x42, 0x61, 0x74, 0x63, 0x68, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x54, 0x61, 0x67, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x54, 0x61,
0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x73, 0x22, 0x18, 0x0a, 0x16, 0x42, 0x61, 0x74, 0x63, 0x68, 0x55, 0x70, 0x73, 0x65, 0x72,
0x74, 0x54, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x0a, 0x0f,
0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75,
0x73, 0x65, 0x72, 0x22, 0x39, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x22, 0x5c,
0x0a, 0x10, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x6c, 0x64, 0x5f, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x6c, 0x64, 0x4e, 0x61, 0x6d,
0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20,
0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x38, 0x0a, 0x11,
0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x54, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x23, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11,
0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61,
0x67, 0x52, 0x03, 0x74, 0x61, 0x67, 0x22, 0x37, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x03, 0x74, 0x61,
0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x03, 0x74, 0x61, 0x67, 0x22,
0x13, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x54, 0x61, 0x67, 0x53, 0x75,
0x67, 0x67, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x75, 0x73, 0x65, 0x72, 0x22, 0x39, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73,
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x22,
0x5c, 0x0a, 0x10, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x6c, 0x64, 0x5f, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x6c, 0x64, 0x4e, 0x61,
0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x38, 0x0a,
0x11, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x54, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x23, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x11, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54,
0x61, 0x67, 0x52, 0x03, 0x74, 0x61, 0x67, 0x22, 0x37, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74,
0x65, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x03, 0x74,
0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x03, 0x74, 0x61, 0x67,
0x22, 0x13, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x67, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x54, 0x61, 0x67, 0x53,
0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x2f, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x54, 0x61, 0x67, 0x53,
0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09,
0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x32, 0xa8, 0x04, 0x0a, 0x0a, 0x54, 0x61, 0x67, 0x53, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x62, 0x0a, 0x09, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x54,
0x61, 0x67, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,
0x32, 0x2e, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,
0x32, 0x2e, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x54, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x22, 0x0c, 0x2f, 0x61, 0x70,
0x69, 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x12, 0x5f, 0x0a, 0x08, 0x4c, 0x69, 0x73,
0x74, 0x54, 0x61, 0x67, 0x73, 0x12, 0x1d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,
0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x61,
0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x12, 0x69, 0x0a, 0x09, 0x52, 0x65,
0x6e, 0x61, 0x6d, 0x65, 0x54, 0x61, 0x67, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x54, 0x61, 0x67,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x54, 0x61, 0x67,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15,
0x32, 0x13, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x3a, 0x72,
0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x62, 0x0a, 0x09, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54,
0x61, 0x67, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,
0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,
0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x2a, 0x0c, 0x2f, 0x61, 0x70,
0x69, 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x12, 0x85, 0x01, 0x0a, 0x11, 0x47, 0x65,
0x74, 0x54, 0x61, 0x67, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12,
0x26, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47,
0x65, 0x74, 0x54, 0x61, 0x67, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73,
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, 0x54, 0x61, 0x67, 0x53, 0x75, 0x67,
0x67, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x12, 0x17, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76,
0x32, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x2f, 0x73, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x69, 0x6f,
0x6e, 0x42, 0xa7, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x42, 0x0f, 0x54, 0x61, 0x67, 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,
0x75, 0x73, 0x65, 0x72, 0x22, 0x2f, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x54, 0x61, 0x67, 0x53, 0x75,
0x67, 0x67, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52,
0x04, 0x74, 0x61, 0x67, 0x73, 0x32, 0xa7, 0x05, 0x0a, 0x0a, 0x54, 0x61, 0x67, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x12, 0x62, 0x0a, 0x09, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x54, 0x61,
0x67, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
0x2e, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
0x2e, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x54, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x22, 0x0c, 0x2f, 0x61, 0x70, 0x69,
0x2f, 0x76, 0x32, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x12, 0x7d, 0x0a, 0x0e, 0x42, 0x61, 0x74, 0x63,
0x68, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x54, 0x61, 0x67, 0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d,
0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x55,
0x70, 0x73, 0x65, 0x72, 0x74, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x24, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x42,
0x61, 0x74, 0x63, 0x68, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x54, 0x61, 0x67, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x22, 0x18, 0x2f,
0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x3a, 0x62, 0x61, 0x74, 0x63,
0x68, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x12, 0x5f, 0x0a, 0x08, 0x4c, 0x69, 0x73, 0x74, 0x54,
0x61, 0x67, 0x73, 0x12, 0x1d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,
0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x61, 0x70, 0x69,
0x2f, 0x76, 0x32, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x12, 0x69, 0x0a, 0x09, 0x52, 0x65, 0x6e, 0x61,
0x6d, 0x65, 0x54, 0x61, 0x67, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x54, 0x61, 0x67, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x54, 0x61, 0x67, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x32, 0x13,
0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x3a, 0x72, 0x65, 0x6e,
0x61, 0x6d, 0x65, 0x12, 0x62, 0x0a, 0x09, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x67,
0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x2a, 0x0c, 0x2f, 0x61, 0x70, 0x69, 0x2f,
0x76, 0x32, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x12, 0x85, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x54,
0x61, 0x67, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x2e,
0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74,
0x54, 0x61, 0x67, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 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, 0x54, 0x61, 0x67, 0x53, 0x75, 0x67, 0x67, 0x65,
0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x12, 0x17, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f,
0x74, 0x61, 0x67, 0x73, 0x2f, 0x73, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x42,
0xa7, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x76, 0x32, 0x42, 0x0f, 0x54, 0x61, 0x67, 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 (
@ -665,40 +765,45 @@ func file_api_v2_tag_service_proto_rawDescGZIP() []byte {
return file_api_v2_tag_service_proto_rawDescData
}
var file_api_v2_tag_service_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_api_v2_tag_service_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_api_v2_tag_service_proto_goTypes = []interface{}{
(*Tag)(nil), // 0: memos.api.v2.Tag
(*UpsertTagRequest)(nil), // 1: memos.api.v2.UpsertTagRequest
(*UpsertTagResponse)(nil), // 2: memos.api.v2.UpsertTagResponse
(*ListTagsRequest)(nil), // 3: memos.api.v2.ListTagsRequest
(*ListTagsResponse)(nil), // 4: memos.api.v2.ListTagsResponse
(*RenameTagRequest)(nil), // 5: memos.api.v2.RenameTagRequest
(*RenameTagResponse)(nil), // 6: memos.api.v2.RenameTagResponse
(*DeleteTagRequest)(nil), // 7: memos.api.v2.DeleteTagRequest
(*DeleteTagResponse)(nil), // 8: memos.api.v2.DeleteTagResponse
(*GetTagSuggestionsRequest)(nil), // 9: memos.api.v2.GetTagSuggestionsRequest
(*GetTagSuggestionsResponse)(nil), // 10: memos.api.v2.GetTagSuggestionsResponse
(*BatchUpsertTagRequest)(nil), // 3: memos.api.v2.BatchUpsertTagRequest
(*BatchUpsertTagResponse)(nil), // 4: memos.api.v2.BatchUpsertTagResponse
(*ListTagsRequest)(nil), // 5: memos.api.v2.ListTagsRequest
(*ListTagsResponse)(nil), // 6: memos.api.v2.ListTagsResponse
(*RenameTagRequest)(nil), // 7: memos.api.v2.RenameTagRequest
(*RenameTagResponse)(nil), // 8: memos.api.v2.RenameTagResponse
(*DeleteTagRequest)(nil), // 9: memos.api.v2.DeleteTagRequest
(*DeleteTagResponse)(nil), // 10: memos.api.v2.DeleteTagResponse
(*GetTagSuggestionsRequest)(nil), // 11: memos.api.v2.GetTagSuggestionsRequest
(*GetTagSuggestionsResponse)(nil), // 12: memos.api.v2.GetTagSuggestionsResponse
}
var file_api_v2_tag_service_proto_depIdxs = []int32{
0, // 0: memos.api.v2.UpsertTagResponse.tag:type_name -> memos.api.v2.Tag
0, // 1: memos.api.v2.ListTagsResponse.tags:type_name -> memos.api.v2.Tag
0, // 2: memos.api.v2.RenameTagResponse.tag:type_name -> memos.api.v2.Tag
0, // 3: memos.api.v2.DeleteTagRequest.tag:type_name -> memos.api.v2.Tag
1, // 4: memos.api.v2.TagService.UpsertTag:input_type -> memos.api.v2.UpsertTagRequest
3, // 5: memos.api.v2.TagService.ListTags:input_type -> memos.api.v2.ListTagsRequest
5, // 6: memos.api.v2.TagService.RenameTag:input_type -> memos.api.v2.RenameTagRequest
7, // 7: memos.api.v2.TagService.DeleteTag:input_type -> memos.api.v2.DeleteTagRequest
9, // 8: memos.api.v2.TagService.GetTagSuggestions:input_type -> memos.api.v2.GetTagSuggestionsRequest
2, // 9: memos.api.v2.TagService.UpsertTag:output_type -> memos.api.v2.UpsertTagResponse
4, // 10: memos.api.v2.TagService.ListTags:output_type -> memos.api.v2.ListTagsResponse
6, // 11: memos.api.v2.TagService.RenameTag:output_type -> memos.api.v2.RenameTagResponse
8, // 12: memos.api.v2.TagService.DeleteTag:output_type -> memos.api.v2.DeleteTagResponse
10, // 13: memos.api.v2.TagService.GetTagSuggestions:output_type -> memos.api.v2.GetTagSuggestionsResponse
9, // [9:14] is the sub-list for method output_type
4, // [4:9] 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
1, // 1: memos.api.v2.BatchUpsertTagRequest.requests:type_name -> memos.api.v2.UpsertTagRequest
0, // 2: memos.api.v2.ListTagsResponse.tags:type_name -> memos.api.v2.Tag
0, // 3: memos.api.v2.RenameTagResponse.tag:type_name -> memos.api.v2.Tag
0, // 4: memos.api.v2.DeleteTagRequest.tag:type_name -> memos.api.v2.Tag
1, // 5: memos.api.v2.TagService.UpsertTag:input_type -> memos.api.v2.UpsertTagRequest
3, // 6: memos.api.v2.TagService.BatchUpsertTag:input_type -> memos.api.v2.BatchUpsertTagRequest
5, // 7: memos.api.v2.TagService.ListTags:input_type -> memos.api.v2.ListTagsRequest
7, // 8: memos.api.v2.TagService.RenameTag:input_type -> memos.api.v2.RenameTagRequest
9, // 9: memos.api.v2.TagService.DeleteTag:input_type -> memos.api.v2.DeleteTagRequest
11, // 10: memos.api.v2.TagService.GetTagSuggestions:input_type -> memos.api.v2.GetTagSuggestionsRequest
2, // 11: memos.api.v2.TagService.UpsertTag:output_type -> memos.api.v2.UpsertTagResponse
4, // 12: memos.api.v2.TagService.BatchUpsertTag:output_type -> memos.api.v2.BatchUpsertTagResponse
6, // 13: memos.api.v2.TagService.ListTags:output_type -> memos.api.v2.ListTagsResponse
8, // 14: memos.api.v2.TagService.RenameTag:output_type -> memos.api.v2.RenameTagResponse
10, // 15: memos.api.v2.TagService.DeleteTag:output_type -> memos.api.v2.DeleteTagResponse
12, // 16: memos.api.v2.TagService.GetTagSuggestions:output_type -> memos.api.v2.GetTagSuggestionsResponse
11, // [11:17] is the sub-list for method output_type
5, // [5:11] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_api_v2_tag_service_proto_init() }
@ -744,7 +849,7 @@ func file_api_v2_tag_service_proto_init() {
}
}
file_api_v2_tag_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListTagsRequest); i {
switch v := v.(*BatchUpsertTagRequest); i {
case 0:
return &v.state
case 1:
@ -756,7 +861,7 @@ func file_api_v2_tag_service_proto_init() {
}
}
file_api_v2_tag_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListTagsResponse); i {
switch v := v.(*BatchUpsertTagResponse); i {
case 0:
return &v.state
case 1:
@ -768,7 +873,7 @@ func file_api_v2_tag_service_proto_init() {
}
}
file_api_v2_tag_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RenameTagRequest); i {
switch v := v.(*ListTagsRequest); i {
case 0:
return &v.state
case 1:
@ -780,7 +885,7 @@ func file_api_v2_tag_service_proto_init() {
}
}
file_api_v2_tag_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RenameTagResponse); i {
switch v := v.(*ListTagsResponse); i {
case 0:
return &v.state
case 1:
@ -792,7 +897,7 @@ func file_api_v2_tag_service_proto_init() {
}
}
file_api_v2_tag_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteTagRequest); i {
switch v := v.(*RenameTagRequest); i {
case 0:
return &v.state
case 1:
@ -804,7 +909,7 @@ func file_api_v2_tag_service_proto_init() {
}
}
file_api_v2_tag_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteTagResponse); i {
switch v := v.(*RenameTagResponse); i {
case 0:
return &v.state
case 1:
@ -816,7 +921,7 @@ func file_api_v2_tag_service_proto_init() {
}
}
file_api_v2_tag_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetTagSuggestionsRequest); i {
switch v := v.(*DeleteTagRequest); i {
case 0:
return &v.state
case 1:
@ -828,6 +933,30 @@ func file_api_v2_tag_service_proto_init() {
}
}
file_api_v2_tag_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteTagResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_api_v2_tag_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetTagSuggestionsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_api_v2_tag_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetTagSuggestionsResponse); i {
case 0:
return &v.state
@ -846,7 +975,7 @@ func file_api_v2_tag_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_v2_tag_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 11,
NumMessages: 13,
NumExtensions: 0,
NumServices: 1,
},

View File

@ -67,6 +67,42 @@ func local_request_TagService_UpsertTag_0(ctx context.Context, marshaler runtime
}
var (
filter_TagService_BatchUpsertTag_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_TagService_BatchUpsertTag_0(ctx context.Context, marshaler runtime.Marshaler, client TagServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq BatchUpsertTagRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_TagService_BatchUpsertTag_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.BatchUpsertTag(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_TagService_BatchUpsertTag_0(ctx context.Context, marshaler runtime.Marshaler, server TagServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq BatchUpsertTagRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_TagService_BatchUpsertTag_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.BatchUpsertTag(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_TagService_ListTags_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
@ -242,6 +278,31 @@ func RegisterTagServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,
})
mux.Handle("POST", pattern_TagService_BatchUpsertTag_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.TagService/BatchUpsertTag", runtime.WithHTTPPathPattern("/api/v2/tags:batchUpsert"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_TagService_BatchUpsertTag_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_TagService_BatchUpsertTag_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_TagService_ListTags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@ -405,6 +466,28 @@ func RegisterTagServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
})
mux.Handle("POST", pattern_TagService_BatchUpsertTag_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.TagService/BatchUpsertTag", runtime.WithHTTPPathPattern("/api/v2/tags:batchUpsert"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_TagService_BatchUpsertTag_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_TagService_BatchUpsertTag_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_TagService_ListTags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@ -499,6 +582,8 @@ func RegisterTagServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
var (
pattern_TagService_UpsertTag_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v2", "tags"}, ""))
pattern_TagService_BatchUpsertTag_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v2", "tags"}, "batchUpsert"))
pattern_TagService_ListTags_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v2", "tags"}, ""))
pattern_TagService_RenameTag_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v2", "tags"}, "rename"))
@ -511,6 +596,8 @@ var (
var (
forward_TagService_UpsertTag_0 = runtime.ForwardResponseMessage
forward_TagService_BatchUpsertTag_0 = runtime.ForwardResponseMessage
forward_TagService_ListTags_0 = runtime.ForwardResponseMessage
forward_TagService_RenameTag_0 = runtime.ForwardResponseMessage

View File

@ -20,6 +20,7 @@ const _ = grpc.SupportPackageIsVersion7
const (
TagService_UpsertTag_FullMethodName = "/memos.api.v2.TagService/UpsertTag"
TagService_BatchUpsertTag_FullMethodName = "/memos.api.v2.TagService/BatchUpsertTag"
TagService_ListTags_FullMethodName = "/memos.api.v2.TagService/ListTags"
TagService_RenameTag_FullMethodName = "/memos.api.v2.TagService/RenameTag"
TagService_DeleteTag_FullMethodName = "/memos.api.v2.TagService/DeleteTag"
@ -31,6 +32,7 @@ const (
// 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 TagServiceClient interface {
UpsertTag(ctx context.Context, in *UpsertTagRequest, opts ...grpc.CallOption) (*UpsertTagResponse, error)
BatchUpsertTag(ctx context.Context, in *BatchUpsertTagRequest, opts ...grpc.CallOption) (*BatchUpsertTagResponse, error)
ListTags(ctx context.Context, in *ListTagsRequest, opts ...grpc.CallOption) (*ListTagsResponse, error)
RenameTag(ctx context.Context, in *RenameTagRequest, opts ...grpc.CallOption) (*RenameTagResponse, error)
DeleteTag(ctx context.Context, in *DeleteTagRequest, opts ...grpc.CallOption) (*DeleteTagResponse, error)
@ -54,6 +56,15 @@ func (c *tagServiceClient) UpsertTag(ctx context.Context, in *UpsertTagRequest,
return out, nil
}
func (c *tagServiceClient) BatchUpsertTag(ctx context.Context, in *BatchUpsertTagRequest, opts ...grpc.CallOption) (*BatchUpsertTagResponse, error) {
out := new(BatchUpsertTagResponse)
err := c.cc.Invoke(ctx, TagService_BatchUpsertTag_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *tagServiceClient) ListTags(ctx context.Context, in *ListTagsRequest, opts ...grpc.CallOption) (*ListTagsResponse, error) {
out := new(ListTagsResponse)
err := c.cc.Invoke(ctx, TagService_ListTags_FullMethodName, in, out, opts...)
@ -95,6 +106,7 @@ func (c *tagServiceClient) GetTagSuggestions(ctx context.Context, in *GetTagSugg
// for forward compatibility
type TagServiceServer interface {
UpsertTag(context.Context, *UpsertTagRequest) (*UpsertTagResponse, error)
BatchUpsertTag(context.Context, *BatchUpsertTagRequest) (*BatchUpsertTagResponse, error)
ListTags(context.Context, *ListTagsRequest) (*ListTagsResponse, error)
RenameTag(context.Context, *RenameTagRequest) (*RenameTagResponse, error)
DeleteTag(context.Context, *DeleteTagRequest) (*DeleteTagResponse, error)
@ -109,6 +121,9 @@ type UnimplementedTagServiceServer struct {
func (UnimplementedTagServiceServer) UpsertTag(context.Context, *UpsertTagRequest) (*UpsertTagResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpsertTag not implemented")
}
func (UnimplementedTagServiceServer) BatchUpsertTag(context.Context, *BatchUpsertTagRequest) (*BatchUpsertTagResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BatchUpsertTag not implemented")
}
func (UnimplementedTagServiceServer) ListTags(context.Context, *ListTagsRequest) (*ListTagsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListTags not implemented")
}
@ -152,6 +167,24 @@ func _TagService_UpsertTag_Handler(srv interface{}, ctx context.Context, dec fun
return interceptor(ctx, in, info, handler)
}
func _TagService_BatchUpsertTag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(BatchUpsertTagRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TagServiceServer).BatchUpsertTag(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: TagService_BatchUpsertTag_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TagServiceServer).BatchUpsertTag(ctx, req.(*BatchUpsertTagRequest))
}
return interceptor(ctx, in, info, handler)
}
func _TagService_ListTags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListTagsRequest)
if err := dec(in); err != nil {
@ -235,6 +268,10 @@ var TagService_ServiceDesc = grpc.ServiceDesc{
MethodName: "UpsertTag",
Handler: _TagService_UpsertTag_Handler,
},
{
MethodName: "BatchUpsertTag",
Handler: _TagService_BatchUpsertTag_Handler,
},
{
MethodName: "ListTags",
Handler: _TagService_ListTags_Handler,

View File

@ -6,7 +6,7 @@ import useLocalStorage from "react-use/lib/useLocalStorage";
import { memoServiceClient } from "@/grpcweb";
import { TAB_SPACE_WIDTH, UNKNOWN_ID } from "@/helpers/consts";
import { isValidUrl } from "@/helpers/utils";
import { useGlobalStore, useResourceStore } from "@/store/module";
import { useGlobalStore, useResourceStore, useTagStore } from "@/store/module";
import { useMemoStore, useUserStore } from "@/store/v1";
import { MemoRelation, MemoRelation_Type } from "@/types/proto/api/v2/memo_relation_service";
import { Memo, Visibility } from "@/types/proto/api/v2/memo_service";
@ -14,6 +14,7 @@ import { Resource } from "@/types/proto/api/v2/resource_service";
import { UserSetting } from "@/types/proto/api/v2/user_service";
import { useTranslate } from "@/utils/i18n";
import { convertVisibilityFromString, convertVisibilityToString } from "@/utils/memo";
import { extractTagsFromContent } from "@/utils/tag";
import showCreateResourceDialog from "../CreateResourceDialog";
import Icon from "../Icon";
import VisibilityIcon from "../VisibilityIcon";
@ -57,6 +58,7 @@ const MemoEditor = (props: Props) => {
const userStore = useUserStore();
const memoStore = useMemoStore();
const resourceStore = useResourceStore();
const tagStore = useTagStore();
const [state, setState] = useState<State>({
memoVisibility: Visibility.PRIVATE,
resourceList: [],
@ -326,6 +328,10 @@ const MemoEditor = (props: Props) => {
toast.error(error.details);
}
// Batch upsert tags.
const tags = extractTagsFromContent(content);
await tagStore.batchUpsertTag(tags);
setState((state) => {
return {
...state,

View File

@ -25,6 +25,17 @@ export const useTagStore = () => {
store.dispatch(upsertTagAction(tagName));
};
const batchUpsertTag = async (tagNames: string[]) => {
await tagServiceClient.batchUpsertTag({
requests: tagNames.map((name) => ({
name,
})),
});
for (const tagName of tagNames) {
store.dispatch(upsertTagAction(tagName));
}
};
const deleteTag = async (tagName: string) => {
await tagServiceClient.deleteTag({
tag: {
@ -40,6 +51,7 @@ export const useTagStore = () => {
getState,
fetchTags,
upsertTag,
batchUpsertTag,
deleteTag,
};
};

View File

@ -1 +1,33 @@
import { Node } from "@/types/node";
export const TAG_REG = /#([^\s#,]+)/;
// extractTagsFromContent extracts tags from content.
export const extractTagsFromContent = (content: string) => {
const nodes = window.parse(content);
const tags = new Set<string>();
const traverse = (nodes: Node[], handle: (node: Node) => void) => {
for (const node of nodes) {
if (!node) {
continue;
}
handle(node);
if (node.paragraphNode || node.unorderedListNode || node.orderedListNode) {
const children = ((node.paragraphNode || node.unorderedListNode || node.orderedListNode) as any).children;
if (Array.isArray(children)) {
traverse(children, handle);
}
}
}
};
traverse(nodes, (node) => {
if (node.tagNode?.content) {
tags.add(node.tagNode.content);
}
});
return Array.from(tags);
};