Autogenerate services.m3o.com (#37)

* Autogenerate services.m3o.com

* Openapi for all

* Gen

* Fix

* Whaat

* Fix dep

* Fix

* Hmm

* Install make

* Debug

* Debug 1

* Location -> locations

* Fix

* Intall protoc gen micro

* F

* F

* F

* Push

* Rename secret

* Fix npm install

* Fix script

* Fix v2

* Ignore errors

* Ignore v2

* F

* F

* F

* Docs index

* Add hugo theme

* Hugo tania fixes

* Change gen

* Change gen 2

* Install hugo

* Change gen

* Gen fix

* Change hugo install

* Change hugo install

* CNAME

* Change articles wording

* Tiny fix

* Fix gen

* Redoc it all

* Fix gen

* Fixing up protos

* Fix proto

* Fix gen

* Fix

* Trigger build

* Fix copy

* Openapi docs

* Flatten

* Changes

* No date vol2

* Changes

* Add make to chat

* Fixes

* Change

* api spec

* replace RSS

* fix link

* Dont continue on error

* increase the width

* use micro at master

* change box colours

* move some things

* Pushing new readmes to see how they look like

* Add skip file

* Readmes

* Nicer api link

* Remove stutter

* FIx mistake

* set service font weight

* Messages readme fix

* add other font bold

* Notes

* Remove post from url

* Revert "Remove post from url"

This reverts commit 5fea2c23d0bafa910f5dc4d4cc63f71f578530e3.

* move exampleSite to site

* replace exampleSite with site

* update readme

* use filename for post

* update index

* Add source urls

* set source as params

* set source as params

* Fix entries

* Generator in go

* Fixes to generator

* F

* Change doc gen

* FIx cname

* Fixing protos

* Change to makefiles

* Fix gen script

Co-authored-by: Asim Aslam <asim@aslam.me>
This commit is contained in:
Janos Dobronszki
2021-01-19 16:59:25 +00:00
committed by GitHub
parent ec81db0753
commit 40b71a9cf9
174 changed files with 10914 additions and 3157 deletions

2
tags/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
./tags

3
tags/Dockerfile Normal file
View File

@@ -0,0 +1,3 @@
FROM alpine
ADD tag-service /tag-service
ENTRYPOINT [ "/tag-service" ]

27
tags/Makefile Normal file
View File

@@ -0,0 +1,27 @@
GOPATH:=$(shell go env GOPATH)
MODIFY=Mgithub.com/micro/micro/proto/api/api.proto=github.com/micro/micro/v3/proto/api
.PHONY: proto
proto:
protoc --openapi_out=. --proto_path=. --micro_out=${MODIFY}:. --go_out=${MODIFY}:. proto/tags.proto
.PHONY: docs
docs:
protoc --openapi_out=. --proto_path=. --micro_out=${MODIFY}:. --go_out=${MODIFY}:. proto/tags.proto
@redoc-cli bundle api-tags.json
.PHONY: build
build: proto
go build -o tag-service *.go
.PHONY: test
test:
go test -v ./... -cover
.PHONY: docker
docker:
docker build . -t tag-service:latest

64
tags/README.md Normal file
View File

@@ -0,0 +1,64 @@
Tag any resource by savin a tag associated with their ID in the tag service.
# Tag Service
## Query tags
```
micro tags list --type=post-tag
```
Generated with
```
micro new --namespace=go.micro --type=service tag
```
## Getting Started
- [Tag Service](#tag-service)
- [Query tags](#query-tags)
- [Getting Started](#getting-started)
- [Configuration](#configuration)
- [Dependencies](#dependencies)
- [Usage](#usage)
## Configuration
- FQDN: go.micro.service.tag
- Type: service
- Alias: tag
## Dependencies
Micro services depend on service discovery. The default is multicast DNS, a zeroconf system.
In the event you need a resilient multi-host setup we recommend etcd.
```
# install etcd
brew install etcd
# run etcd
etcd
```
## Usage
A Makefile is included for convenience
Build the binary
```
make build
```
Run the service
```
./tag-service
```
Build a docker image
```
make docker
```

3
tags/generate.go Normal file
View File

@@ -0,0 +1,3 @@
package main
//go:generate make proto

View File

@@ -0,0 +1,779 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.6.1
// source: proto/tags.proto
package tags
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type Tag struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Type is useful for namespacing and listing across resources,
// ie. list tags for posts, customers etc.
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
Slug string `protobuf:"bytes,2,opt,name=slug,proto3" json:"slug,omitempty"`
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
Count int64 `protobuf:"varint,5,opt,name=count,proto3" json:"count,omitempty"`
}
func (x *Tag) Reset() {
*x = Tag{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Tag) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Tag) ProtoMessage() {}
func (x *Tag) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Tag.ProtoReflect.Descriptor instead.
func (*Tag) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{0}
}
func (x *Tag) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *Tag) GetSlug() string {
if x != nil {
return x.Slug
}
return ""
}
func (x *Tag) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *Tag) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *Tag) GetCount() int64 {
if x != nil {
return x.Count
}
return 0
}
type AddRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ResourceID string `protobuf:"bytes,1,opt,name=resourceID,proto3" json:"resourceID,omitempty"`
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
ResourceCreated int64 `protobuf:"varint,4,opt,name=resourceCreated,proto3" json:"resourceCreated,omitempty"`
}
func (x *AddRequest) Reset() {
*x = AddRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AddRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddRequest) ProtoMessage() {}
func (x *AddRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AddRequest.ProtoReflect.Descriptor instead.
func (*AddRequest) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{1}
}
func (x *AddRequest) GetResourceID() string {
if x != nil {
return x.ResourceID
}
return ""
}
func (x *AddRequest) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *AddRequest) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *AddRequest) GetResourceCreated() int64 {
if x != nil {
return x.ResourceCreated
}
return 0
}
type AddResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *AddResponse) Reset() {
*x = AddResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AddResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddResponse) ProtoMessage() {}
func (x *AddResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AddResponse.ProtoReflect.Descriptor instead.
func (*AddResponse) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{2}
}
type RemoveRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ResourceID string `protobuf:"bytes,1,opt,name=resourceID,proto3" json:"resourceID,omitempty"`
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
}
func (x *RemoveRequest) Reset() {
*x = RemoveRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RemoveRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RemoveRequest) ProtoMessage() {}
func (x *RemoveRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_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 RemoveRequest.ProtoReflect.Descriptor instead.
func (*RemoveRequest) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{3}
}
func (x *RemoveRequest) GetResourceID() string {
if x != nil {
return x.ResourceID
}
return ""
}
func (x *RemoveRequest) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *RemoveRequest) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
type RemoveResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *RemoveResponse) Reset() {
*x = RemoveResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RemoveResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RemoveResponse) ProtoMessage() {}
func (x *RemoveResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_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 RemoveResponse.ProtoReflect.Descriptor instead.
func (*RemoveResponse) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{4}
}
type UpdateRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
}
func (x *UpdateRequest) Reset() {
*x = UpdateRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateRequest) ProtoMessage() {}
func (x *UpdateRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_proto_msgTypes[5]
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 UpdateRequest.ProtoReflect.Descriptor instead.
func (*UpdateRequest) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{5}
}
func (x *UpdateRequest) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *UpdateRequest) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *UpdateRequest) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
type UpdateResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *UpdateResponse) Reset() {
*x = UpdateResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateResponse) ProtoMessage() {}
func (x *UpdateResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_proto_msgTypes[6]
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 UpdateResponse.ProtoReflect.Descriptor instead.
func (*UpdateResponse) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{6}
}
// ListRequest: list either by resource id or type.
// Optionally filter by min or max count.
type ListRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ResourceID string `protobuf:"bytes,1,opt,name=resourceID,proto3" json:"resourceID,omitempty"`
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
MinCount int64 `protobuf:"varint,3,opt,name=minCount,proto3" json:"minCount,omitempty"`
MaxCount int64 `protobuf:"varint,4,opt,name=maxCount,proto3" json:"maxCount,omitempty"`
}
func (x *ListRequest) Reset() {
*x = ListRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListRequest) ProtoMessage() {}
func (x *ListRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_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 ListRequest.ProtoReflect.Descriptor instead.
func (*ListRequest) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{7}
}
func (x *ListRequest) GetResourceID() string {
if x != nil {
return x.ResourceID
}
return ""
}
func (x *ListRequest) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *ListRequest) GetMinCount() int64 {
if x != nil {
return x.MinCount
}
return 0
}
func (x *ListRequest) GetMaxCount() int64 {
if x != nil {
return x.MaxCount
}
return 0
}
type ListResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Tags []*Tag `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"`
}
func (x *ListResponse) Reset() {
*x = ListResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListResponse) ProtoMessage() {}
func (x *ListResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_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 ListResponse.ProtoReflect.Descriptor instead.
func (*ListResponse) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{8}
}
func (x *ListResponse) GetTags() []*Tag {
if x != nil {
return x.Tags
}
return nil
}
var File_proto_tags_proto protoreflect.FileDescriptor
var file_proto_tags_proto_rawDesc = []byte{
0x0a, 0x10, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x04, 0x74, 0x61, 0x67, 0x73, 0x22, 0x7b, 0x0a, 0x03, 0x54, 0x61, 0x67, 0x12,
0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74,
0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6c, 0x75, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x73, 0x6c, 0x75, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a,
0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x80, 0x01, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x28,
0x0a, 0x0f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x22, 0x0d, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x59, 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76,
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x73, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65,
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05,
0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74,
0x6c, 0x65, 0x22, 0x10, 0x0a, 0x0e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5b, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74,
0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12,
0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x22, 0x10, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x79, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x44,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x69, 0x6e, 0x43, 0x6f, 0x75,
0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x43, 0x6f, 0x75,
0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04,
0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x2d,
0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d,
0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x74,
0x61, 0x67, 0x73, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x32, 0xd3, 0x01,
0x0a, 0x04, 0x54, 0x61, 0x67, 0x73, 0x12, 0x2c, 0x0a, 0x03, 0x41, 0x64, 0x64, 0x12, 0x10, 0x2e,
0x74, 0x61, 0x67, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x11, 0x2e, 0x74, 0x61, 0x67, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x06, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x13,
0x2e, 0x74, 0x61, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x61, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76,
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x04, 0x4c,
0x69, 0x73, 0x74, 0x12, 0x11, 0x2e, 0x74, 0x61, 0x67, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x74, 0x61, 0x67, 0x73, 0x2e, 0x4c, 0x69,
0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x06,
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x13, 0x2e, 0x74, 0x61, 0x67, 0x73, 0x2e, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x61,
0x67, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x00, 0x42, 0x2b, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73,
0x2f, 0x74, 0x61, 0x67, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x74, 0x61, 0x67, 0x73,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_proto_tags_proto_rawDescOnce sync.Once
file_proto_tags_proto_rawDescData = file_proto_tags_proto_rawDesc
)
func file_proto_tags_proto_rawDescGZIP() []byte {
file_proto_tags_proto_rawDescOnce.Do(func() {
file_proto_tags_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_tags_proto_rawDescData)
})
return file_proto_tags_proto_rawDescData
}
var file_proto_tags_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_proto_tags_proto_goTypes = []interface{}{
(*Tag)(nil), // 0: tags.Tag
(*AddRequest)(nil), // 1: tags.AddRequest
(*AddResponse)(nil), // 2: tags.AddResponse
(*RemoveRequest)(nil), // 3: tags.RemoveRequest
(*RemoveResponse)(nil), // 4: tags.RemoveResponse
(*UpdateRequest)(nil), // 5: tags.UpdateRequest
(*UpdateResponse)(nil), // 6: tags.UpdateResponse
(*ListRequest)(nil), // 7: tags.ListRequest
(*ListResponse)(nil), // 8: tags.ListResponse
}
var file_proto_tags_proto_depIdxs = []int32{
0, // 0: tags.ListResponse.tags:type_name -> tags.Tag
1, // 1: tags.Tags.Add:input_type -> tags.AddRequest
3, // 2: tags.Tags.Remove:input_type -> tags.RemoveRequest
7, // 3: tags.Tags.List:input_type -> tags.ListRequest
5, // 4: tags.Tags.Update:input_type -> tags.UpdateRequest
2, // 5: tags.Tags.Add:output_type -> tags.AddResponse
4, // 6: tags.Tags.Remove:output_type -> tags.RemoveResponse
8, // 7: tags.Tags.List:output_type -> tags.ListResponse
6, // 8: tags.Tags.Update:output_type -> tags.UpdateResponse
5, // [5:9] is the sub-list for method output_type
1, // [1:5] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_proto_tags_proto_init() }
func file_proto_tags_proto_init() {
if File_proto_tags_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_proto_tags_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Tag); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RemoveRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RemoveResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_proto_tags_proto_rawDesc,
NumEnums: 0,
NumMessages: 9,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_proto_tags_proto_goTypes,
DependencyIndexes: file_proto_tags_proto_depIdxs,
MessageInfos: file_proto_tags_proto_msgTypes,
}.Build()
File_proto_tags_proto = out.File
file_proto_tags_proto_rawDesc = nil
file_proto_tags_proto_goTypes = nil
file_proto_tags_proto_depIdxs = nil
}

View File

@@ -0,0 +1,152 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/tags.proto
package tags
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
api "github.com/micro/micro/v3/service/api"
client "github.com/micro/micro/v3/service/client"
server "github.com/micro/micro/v3/service/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for Tags service
func NewTagsEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for Tags service
type TagsService interface {
// Add a tag to a resource
Add(ctx context.Context, in *AddRequest, opts ...client.CallOption) (*AddResponse, error)
// Remove a tag from a resource
Remove(ctx context.Context, in *RemoveRequest, opts ...client.CallOption) (*RemoveResponse, error)
// List tags by
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
// Change properties of a tag, currently only the title and description
Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error)
}
type tagsService struct {
c client.Client
name string
}
func NewTagsService(name string, c client.Client) TagsService {
return &tagsService{
c: c,
name: name,
}
}
func (c *tagsService) Add(ctx context.Context, in *AddRequest, opts ...client.CallOption) (*AddResponse, error) {
req := c.c.NewRequest(c.name, "Tags.Add", in)
out := new(AddResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *tagsService) Remove(ctx context.Context, in *RemoveRequest, opts ...client.CallOption) (*RemoveResponse, error) {
req := c.c.NewRequest(c.name, "Tags.Remove", in)
out := new(RemoveResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *tagsService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
req := c.c.NewRequest(c.name, "Tags.List", in)
out := new(ListResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *tagsService) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) {
req := c.c.NewRequest(c.name, "Tags.Update", in)
out := new(UpdateResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Tags service
type TagsHandler interface {
// Add a tag to a resource
Add(context.Context, *AddRequest, *AddResponse) error
// Remove a tag from a resource
Remove(context.Context, *RemoveRequest, *RemoveResponse) error
// List tags by
List(context.Context, *ListRequest, *ListResponse) error
// Change properties of a tag, currently only the title and description
Update(context.Context, *UpdateRequest, *UpdateResponse) error
}
func RegisterTagsHandler(s server.Server, hdlr TagsHandler, opts ...server.HandlerOption) error {
type tags interface {
Add(ctx context.Context, in *AddRequest, out *AddResponse) error
Remove(ctx context.Context, in *RemoveRequest, out *RemoveResponse) error
List(ctx context.Context, in *ListRequest, out *ListResponse) error
Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error
}
type Tags struct {
tags
}
h := &tagsHandler{hdlr}
return s.Handle(s.NewHandler(&Tags{h}, opts...))
}
type tagsHandler struct {
TagsHandler
}
func (h *tagsHandler) Add(ctx context.Context, in *AddRequest, out *AddResponse) error {
return h.TagsHandler.Add(ctx, in, out)
}
func (h *tagsHandler) Remove(ctx context.Context, in *RemoveRequest, out *RemoveResponse) error {
return h.TagsHandler.Remove(ctx, in, out)
}
func (h *tagsHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
return h.TagsHandler.List(ctx, in, out)
}
func (h *tagsHandler) Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error {
return h.TagsHandler.Update(ctx, in, out)
}

223
tags/handler/tags.go Normal file
View File

@@ -0,0 +1,223 @@
package handler
import (
"context"
"encoding/json"
"fmt"
"github.com/gosimple/slug"
"github.com/micro/dev/model"
"github.com/micro/micro/v3/service/errors"
"github.com/micro/micro/v3/service/logger"
"github.com/micro/micro/v3/service/store"
proto "github.com/micro/services/tags/proto"
)
const (
resourcePrefix = "byResource"
tagCountPrefix = "tagCount"
childrenByTag = "childrenByTag"
)
type Tags struct {
db model.Model
}
func NewTags() *Tags {
slugIndex := model.ByEquality("slug")
slugIndex.Order.Type = model.OrderTypeUnordered
return &Tags{
db: model.New(
store.DefaultStore,
"tags",
model.Indexes(model.ByEquality("type")),
&model.ModelOptions{
IdIndex: slugIndex,
Debug: false,
},
),
}
}
func (t *Tags) Add(ctx context.Context, req *proto.AddRequest, rsp *proto.AddResponse) error {
if len(req.ResourceID) == 0 || len(req.Type) == 0 {
return errors.BadRequest("tags.increasecount.input-check", "resource id and type is required")
}
tags := []*proto.Tag{}
tagSlug := slug.Make(req.GetTitle())
q := model.Equals("slug", tagSlug)
q.Order.Type = model.OrderTypeUnordered
err := t.db.List(q, &tags)
if err != nil {
return err
}
var tag *proto.Tag
// If no existing record is found, create a new one
if len(tags) == 0 {
tag = &proto.Tag{
Title: req.GetTitle(),
Type: req.Type,
Slug: tagSlug,
}
} else {
tag = tags[0]
}
// increase tag count
err = store.Write(&store.Record{
Key: fmt.Sprintf("%v:%v:%v", tagCountPrefix, tag.Slug, req.GetResourceID()),
Value: nil,
})
if err != nil {
return err
}
oldTagCount := tag.Count
// get tag count
recs, err := store.List(store.Prefix(fmt.Sprintf("%v:%v", tagCountPrefix, tag.Slug)), store.Limit(1000))
if err != nil {
return err
}
tag.Count = int64(len(recs))
if tag.Count == oldTagCount {
return fmt.Errorf("Tag count for tag %v is unchanged, was: %v, now: %v", tagSlug, oldTagCount, tag.Count)
}
tagJSON, err := json.Marshal(tag)
if err != nil {
return err
}
err = store.Write(&store.Record{
Key: fmt.Sprintf("%v:%v:%v", resourcePrefix, req.GetResourceID(), tag.Slug),
Value: tagJSON,
})
if err != nil {
return err
}
return t.saveTag(tag)
}
func (t *Tags) saveTag(tag *proto.Tag) error {
tag.Slug = slug.Make(tag.Title)
return t.db.Save(tag)
}
func (t *Tags) Remove(ctx context.Context, req *proto.RemoveRequest, rsp *proto.RemoveResponse) error {
if len(req.ResourceID) == 0 || len(req.Type) == 0 {
return errors.BadRequest("tags.decreaseecount.input-check", "resource id and type is required")
}
tagSlug := slug.Make(req.GetTitle())
resourceKey := fmt.Sprintf("%v:%v:%v", resourcePrefix, req.GetResourceID(), tagSlug)
// read by resource ID + slug, the record is identical in boths places anyway
records, err := store.Read(resourceKey)
if err != nil && err != store.ErrNotFound {
return err
}
// If no existing record is found, there is nothing to decrease
if len(records) == 0 {
// return error?
return nil
}
record := records[0]
tag := &proto.Tag{}
err = json.Unmarshal(record.Value, tag)
if err != nil {
return err
}
// decrease tag count
err = store.Delete(fmt.Sprintf("%v:%v:%v", tagCountPrefix, tag.Slug, req.GetResourceID()))
if err != nil {
return err
}
// get tag count
recs, err := store.List(store.Prefix(fmt.Sprintf("%v:%v", tagCountPrefix, tag.Slug)), store.Limit(1000))
if err != nil {
return err
}
tag.Count = int64(len(recs))
return t.saveTag(tag)
}
func (t *Tags) List(ctx context.Context, req *proto.ListRequest, rsp *proto.ListResponse) error {
logger.Info("Received Tags.List request")
// unfortunately there is a mixing of manual indexes
// and model here because model does not yet support
// many to many relations
key := ""
var q model.Query
if len(req.ResourceID) > 0 {
key = fmt.Sprintf("%v:%v", resourcePrefix, req.ResourceID)
} else if len(req.Type) > 0 {
q = model.Equals("type", req.Type)
} else {
return errors.BadRequest("tags.list.input-check", "resource id or type is required")
}
if q.Type != "" {
tags := []proto.Tag{}
err := t.db.List(q, &tags)
if err != nil {
return err
}
rsp.Tags = make([]*proto.Tag, len(tags))
for i, tag := range tags {
rsp.Tags[i] = &proto.Tag{
Title: tag.Title,
Type: tag.Type,
Slug: tag.Slug,
Count: tag.Count,
}
}
return nil
}
records, err := store.Read("", store.Prefix(key))
if err != nil {
return err
}
rsp.Tags = make([]*proto.Tag, len(records))
for i, record := range records {
tagRecord := &proto.Tag{}
err := json.Unmarshal(record.Value, tagRecord)
if err != nil {
return err
}
rsp.Tags[i] = &proto.Tag{
Title: tagRecord.Title,
Type: tagRecord.Type,
Slug: tagRecord.Slug,
Count: tagRecord.Count,
}
}
return nil
}
func (t *Tags) Update(ctx context.Context, req *proto.UpdateRequest, rsp *proto.UpdateResponse) error {
if len(req.Title) == 0 || len(req.Type) == 0 {
return errors.BadRequest("tags.update.input-check", "title and type is required")
}
tagSlug := slug.Make(req.GetTitle())
tags := []proto.Tag{}
q := model.Equals("slug", tagSlug)
q.Order.Type = model.OrderTypeUnordered
err := t.db.List(q, &tags)
if err != nil {
return err
}
if len(tags) == 0 {
return errors.BadRequest("tags.update.input-check", "Tag not found")
}
tags[0].Title = req.Title
return t.saveTag(&tags[0])
}

23
tags/main.go Normal file
View File

@@ -0,0 +1,23 @@
package main
import (
"github.com/micro/micro/v3/service"
"github.com/micro/micro/v3/service/logger"
"github.com/micro/services/tags/handler"
)
func main() {
// Create service
srv := service.New(
service.Name("tags"),
)
// Register Handler
srv.Handle(handler.NewTags())
// Run service
if err := srv.Run(); err != nil {
logger.Fatal(err)
}
}

1
tags/micro.mu Normal file
View File

@@ -0,0 +1 @@
service tags

777
tags/proto/tags.pb.go Normal file
View File

@@ -0,0 +1,777 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.6.1
// source: proto/tags.proto
package tags
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type Tag struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Type is useful for namespacing and listing across resources,
// ie. list tags for posts, customers etc.
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
Slug string `protobuf:"bytes,2,opt,name=slug,proto3" json:"slug,omitempty"`
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
Count int64 `protobuf:"varint,5,opt,name=count,proto3" json:"count,omitempty"`
}
func (x *Tag) Reset() {
*x = Tag{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Tag) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Tag) ProtoMessage() {}
func (x *Tag) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Tag.ProtoReflect.Descriptor instead.
func (*Tag) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{0}
}
func (x *Tag) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *Tag) GetSlug() string {
if x != nil {
return x.Slug
}
return ""
}
func (x *Tag) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *Tag) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *Tag) GetCount() int64 {
if x != nil {
return x.Count
}
return 0
}
type AddRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ResourceID string `protobuf:"bytes,1,opt,name=resourceID,proto3" json:"resourceID,omitempty"`
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
ResourceCreated int64 `protobuf:"varint,4,opt,name=resourceCreated,proto3" json:"resourceCreated,omitempty"`
}
func (x *AddRequest) Reset() {
*x = AddRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AddRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddRequest) ProtoMessage() {}
func (x *AddRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AddRequest.ProtoReflect.Descriptor instead.
func (*AddRequest) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{1}
}
func (x *AddRequest) GetResourceID() string {
if x != nil {
return x.ResourceID
}
return ""
}
func (x *AddRequest) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *AddRequest) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *AddRequest) GetResourceCreated() int64 {
if x != nil {
return x.ResourceCreated
}
return 0
}
type AddResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *AddResponse) Reset() {
*x = AddResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AddResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddResponse) ProtoMessage() {}
func (x *AddResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AddResponse.ProtoReflect.Descriptor instead.
func (*AddResponse) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{2}
}
type RemoveRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ResourceID string `protobuf:"bytes,1,opt,name=resourceID,proto3" json:"resourceID,omitempty"`
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
}
func (x *RemoveRequest) Reset() {
*x = RemoveRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RemoveRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RemoveRequest) ProtoMessage() {}
func (x *RemoveRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_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 RemoveRequest.ProtoReflect.Descriptor instead.
func (*RemoveRequest) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{3}
}
func (x *RemoveRequest) GetResourceID() string {
if x != nil {
return x.ResourceID
}
return ""
}
func (x *RemoveRequest) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *RemoveRequest) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
type RemoveResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *RemoveResponse) Reset() {
*x = RemoveResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RemoveResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RemoveResponse) ProtoMessage() {}
func (x *RemoveResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_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 RemoveResponse.ProtoReflect.Descriptor instead.
func (*RemoveResponse) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{4}
}
type UpdateRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
}
func (x *UpdateRequest) Reset() {
*x = UpdateRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateRequest) ProtoMessage() {}
func (x *UpdateRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_proto_msgTypes[5]
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 UpdateRequest.ProtoReflect.Descriptor instead.
func (*UpdateRequest) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{5}
}
func (x *UpdateRequest) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *UpdateRequest) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *UpdateRequest) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
type UpdateResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *UpdateResponse) Reset() {
*x = UpdateResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateResponse) ProtoMessage() {}
func (x *UpdateResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_proto_msgTypes[6]
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 UpdateResponse.ProtoReflect.Descriptor instead.
func (*UpdateResponse) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{6}
}
// ListRequest: list either by resource id or type.
// Optionally filter by min or max count.
type ListRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ResourceID string `protobuf:"bytes,1,opt,name=resourceID,proto3" json:"resourceID,omitempty"`
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
MinCount int64 `protobuf:"varint,3,opt,name=minCount,proto3" json:"minCount,omitempty"`
MaxCount int64 `protobuf:"varint,4,opt,name=maxCount,proto3" json:"maxCount,omitempty"`
}
func (x *ListRequest) Reset() {
*x = ListRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListRequest) ProtoMessage() {}
func (x *ListRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_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 ListRequest.ProtoReflect.Descriptor instead.
func (*ListRequest) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{7}
}
func (x *ListRequest) GetResourceID() string {
if x != nil {
return x.ResourceID
}
return ""
}
func (x *ListRequest) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *ListRequest) GetMinCount() int64 {
if x != nil {
return x.MinCount
}
return 0
}
func (x *ListRequest) GetMaxCount() int64 {
if x != nil {
return x.MaxCount
}
return 0
}
type ListResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Tags []*Tag `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"`
}
func (x *ListResponse) Reset() {
*x = ListResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_tags_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListResponse) ProtoMessage() {}
func (x *ListResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_tags_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 ListResponse.ProtoReflect.Descriptor instead.
func (*ListResponse) Descriptor() ([]byte, []int) {
return file_proto_tags_proto_rawDescGZIP(), []int{8}
}
func (x *ListResponse) GetTags() []*Tag {
if x != nil {
return x.Tags
}
return nil
}
var File_proto_tags_proto protoreflect.FileDescriptor
var file_proto_tags_proto_rawDesc = []byte{
0x0a, 0x10, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x04, 0x74, 0x61, 0x67, 0x73, 0x22, 0x7b, 0x0a, 0x03, 0x54, 0x61, 0x67, 0x12,
0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74,
0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6c, 0x75, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x73, 0x6c, 0x75, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a,
0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x80, 0x01, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x28,
0x0a, 0x0f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x22, 0x0d, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x59, 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76,
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x73, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65,
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05,
0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74,
0x6c, 0x65, 0x22, 0x10, 0x0a, 0x0e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5b, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74,
0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12,
0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x22, 0x10, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x79, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x44,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x69, 0x6e, 0x43, 0x6f, 0x75,
0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x43, 0x6f, 0x75,
0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04,
0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x2d,
0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d,
0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x74,
0x61, 0x67, 0x73, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x32, 0xd3, 0x01,
0x0a, 0x04, 0x54, 0x61, 0x67, 0x73, 0x12, 0x2c, 0x0a, 0x03, 0x41, 0x64, 0x64, 0x12, 0x10, 0x2e,
0x74, 0x61, 0x67, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x11, 0x2e, 0x74, 0x61, 0x67, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x06, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x13,
0x2e, 0x74, 0x61, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x61, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76,
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x04, 0x4c,
0x69, 0x73, 0x74, 0x12, 0x11, 0x2e, 0x74, 0x61, 0x67, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x74, 0x61, 0x67, 0x73, 0x2e, 0x4c, 0x69,
0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x06,
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x13, 0x2e, 0x74, 0x61, 0x67, 0x73, 0x2e, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x61,
0x67, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x00, 0x42, 0x0c, 0x5a, 0x0a, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x74, 0x61, 0x67,
0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_proto_tags_proto_rawDescOnce sync.Once
file_proto_tags_proto_rawDescData = file_proto_tags_proto_rawDesc
)
func file_proto_tags_proto_rawDescGZIP() []byte {
file_proto_tags_proto_rawDescOnce.Do(func() {
file_proto_tags_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_tags_proto_rawDescData)
})
return file_proto_tags_proto_rawDescData
}
var file_proto_tags_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_proto_tags_proto_goTypes = []interface{}{
(*Tag)(nil), // 0: tags.Tag
(*AddRequest)(nil), // 1: tags.AddRequest
(*AddResponse)(nil), // 2: tags.AddResponse
(*RemoveRequest)(nil), // 3: tags.RemoveRequest
(*RemoveResponse)(nil), // 4: tags.RemoveResponse
(*UpdateRequest)(nil), // 5: tags.UpdateRequest
(*UpdateResponse)(nil), // 6: tags.UpdateResponse
(*ListRequest)(nil), // 7: tags.ListRequest
(*ListResponse)(nil), // 8: tags.ListResponse
}
var file_proto_tags_proto_depIdxs = []int32{
0, // 0: tags.ListResponse.tags:type_name -> tags.Tag
1, // 1: tags.Tags.Add:input_type -> tags.AddRequest
3, // 2: tags.Tags.Remove:input_type -> tags.RemoveRequest
7, // 3: tags.Tags.List:input_type -> tags.ListRequest
5, // 4: tags.Tags.Update:input_type -> tags.UpdateRequest
2, // 5: tags.Tags.Add:output_type -> tags.AddResponse
4, // 6: tags.Tags.Remove:output_type -> tags.RemoveResponse
8, // 7: tags.Tags.List:output_type -> tags.ListResponse
6, // 8: tags.Tags.Update:output_type -> tags.UpdateResponse
5, // [5:9] is the sub-list for method output_type
1, // [1:5] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_proto_tags_proto_init() }
func file_proto_tags_proto_init() {
if File_proto_tags_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_proto_tags_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Tag); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RemoveRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RemoveResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_tags_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_proto_tags_proto_rawDesc,
NumEnums: 0,
NumMessages: 9,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_proto_tags_proto_goTypes,
DependencyIndexes: file_proto_tags_proto_depIdxs,
MessageInfos: file_proto_tags_proto_msgTypes,
}.Build()
File_proto_tags_proto = out.File
file_proto_tags_proto_rawDesc = nil
file_proto_tags_proto_goTypes = nil
file_proto_tags_proto_depIdxs = nil
}

152
tags/proto/tags.pb.micro.go Normal file
View File

@@ -0,0 +1,152 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/tags.proto
package tags
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
api "github.com/micro/micro/v3/service/api"
client "github.com/micro/micro/v3/service/client"
server "github.com/micro/micro/v3/service/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for Tags service
func NewTagsEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for Tags service
type TagsService interface {
// Add a tag to a resource
Add(ctx context.Context, in *AddRequest, opts ...client.CallOption) (*AddResponse, error)
// Remove a tag from a resource
Remove(ctx context.Context, in *RemoveRequest, opts ...client.CallOption) (*RemoveResponse, error)
// List tags by
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
// Change properties of a tag, currently only the title and description
Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error)
}
type tagsService struct {
c client.Client
name string
}
func NewTagsService(name string, c client.Client) TagsService {
return &tagsService{
c: c,
name: name,
}
}
func (c *tagsService) Add(ctx context.Context, in *AddRequest, opts ...client.CallOption) (*AddResponse, error) {
req := c.c.NewRequest(c.name, "Tags.Add", in)
out := new(AddResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *tagsService) Remove(ctx context.Context, in *RemoveRequest, opts ...client.CallOption) (*RemoveResponse, error) {
req := c.c.NewRequest(c.name, "Tags.Remove", in)
out := new(RemoveResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *tagsService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
req := c.c.NewRequest(c.name, "Tags.List", in)
out := new(ListResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *tagsService) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) {
req := c.c.NewRequest(c.name, "Tags.Update", in)
out := new(UpdateResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Tags service
type TagsHandler interface {
// Add a tag to a resource
Add(context.Context, *AddRequest, *AddResponse) error
// Remove a tag from a resource
Remove(context.Context, *RemoveRequest, *RemoveResponse) error
// List tags by
List(context.Context, *ListRequest, *ListResponse) error
// Change properties of a tag, currently only the title and description
Update(context.Context, *UpdateRequest, *UpdateResponse) error
}
func RegisterTagsHandler(s server.Server, hdlr TagsHandler, opts ...server.HandlerOption) error {
type tags interface {
Add(ctx context.Context, in *AddRequest, out *AddResponse) error
Remove(ctx context.Context, in *RemoveRequest, out *RemoveResponse) error
List(ctx context.Context, in *ListRequest, out *ListResponse) error
Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error
}
type Tags struct {
tags
}
h := &tagsHandler{hdlr}
return s.Handle(s.NewHandler(&Tags{h}, opts...))
}
type tagsHandler struct {
TagsHandler
}
func (h *tagsHandler) Add(ctx context.Context, in *AddRequest, out *AddResponse) error {
return h.TagsHandler.Add(ctx, in, out)
}
func (h *tagsHandler) Remove(ctx context.Context, in *RemoveRequest, out *RemoveResponse) error {
return h.TagsHandler.Remove(ctx, in, out)
}
func (h *tagsHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
return h.TagsHandler.List(ctx, in, out)
}
func (h *tagsHandler) Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error {
return h.TagsHandler.Update(ctx, in, out)
}

64
tags/proto/tags.proto Normal file
View File

@@ -0,0 +1,64 @@
syntax = "proto3";
package tags;
option go_package = "proto;tags";
service Tags {
// Add a tag to a resource
rpc Add(AddRequest) returns (AddResponse) {}
// Remove a tag from a resource
rpc Remove(RemoveRequest) returns (RemoveResponse) {}
// List tags by
rpc List(ListRequest) returns (ListResponse) {}
// Change properties of a tag, currently only the title and description
rpc Update(UpdateRequest) returns (UpdateResponse){}
}
message Tag {
// Type is useful for namespacing and listing across resources,
// ie. list tags for posts, customers etc.
string type = 1;
string slug = 2;
string title = 3;
string description = 4;
int64 count = 5;
}
message AddRequest {
string resourceID = 1;
string type = 2;
string title = 3;
int64 resourceCreated = 4;
}
message AddResponse{}
message RemoveRequest {
string resourceID = 1;
string type = 2;
string title = 3;
}
message RemoveResponse{}
message UpdateRequest {
string type = 1;
string title = 2;
string description = 3;
}
message UpdateResponse{}
// ListRequest: list either by resource id or type.
// Optionally filter by min or max count.
message ListRequest{
string resourceID = 1;
string type = 2;
int64 minCount = 3;
int64 maxCount = 4;
}
message ListResponse{
repeated Tag tags = 1;
}