rename to memegen

This commit is contained in:
Asim Aslam
2022-02-20 21:48:36 +00:00
parent 0a06c3de0c
commit dcbe135b17
18 changed files with 186 additions and 184 deletions

2
meme/.gitignore vendored
View File

@@ -1,2 +0,0 @@
meme

View File

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

View File

@@ -1,7 +0,0 @@
Meme generator
# Meme Service
Generate meme. That's it.
Powered by [Imgflip](https://imgflip.com/api)

View File

@@ -1 +0,0 @@
service meme

View File

@@ -1,6 +0,0 @@
{
"name": "meme",
"icon": "🤦",
"category": "social",
"display_name": "Meme Generator"
}

2
memegen/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
memegen

3
memegen/Dockerfile Normal file
View File

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

View File

@@ -8,15 +8,15 @@ init:
.PHONY: api .PHONY: api
api: api:
protoc --openapi_out=. --proto_path=. proto/meme.proto protoc --openapi_out=. --proto_path=. proto/memegen.proto
.PHONY: proto .PHONY: proto
proto: proto:
protoc --proto_path=. --micro_out=. --go_out=:. proto/meme.proto protoc --proto_path=. --micro_out=. --go_out=:. proto/memegen.proto
.PHONY: build .PHONY: build
build: build:
go build -o meme *.go go build -o memegen *.go
.PHONY: test .PHONY: test
test: test:
@@ -24,4 +24,4 @@ test:
.PHONY: docker .PHONY: docker
docker: docker:
docker build . -t meme:latest docker build . -t memegen:latest

7
memegen/README.md Normal file
View File

@@ -0,0 +1,7 @@
Memegen generator
# Memegen Service
Generate memegen. That's it.
Powered by [Imgflip](https://imgflip.com/api)

View File

@@ -1,8 +1,8 @@
{ {
"templates": [{ "templates": [{
"title": "Meme templates", "title": "Memegen templates",
"description": "List of meme templates", "description": "List of memegen templates",
"run_check": false, "run_check": false,
"request": {}, "request": {},
"response": { "response": {
@@ -27,8 +27,8 @@
} }
}], }],
"generate": [{ "generate": [{
"title": "Generate a meme", "title": "Generate a memegen",
"description": "Generate a meme from a template", "description": "Generate a memegen from a template",
"run_check": false, "run_check": false,
"request": { "request": {
"id": "444501", "id": "444501",

View File

@@ -10,16 +10,16 @@ import (
"github.com/micro/micro/v3/service/config" "github.com/micro/micro/v3/service/config"
"github.com/micro/micro/v3/service/errors" "github.com/micro/micro/v3/service/errors"
"github.com/micro/micro/v3/service/logger" "github.com/micro/micro/v3/service/logger"
pb "github.com/micro/services/meme/proto" pb "github.com/micro/services/memegen/proto"
"github.com/micro/services/pkg/api" "github.com/micro/services/pkg/api"
) )
type Meme struct { type Memegen struct {
username string username string
password string password string
} }
func New() *Meme { func New() *Memegen {
v, err := config.Get("imgflip.username") v, err := config.Get("imgflip.username")
if err != nil { if err != nil {
logger.Fatalf("imgflip.username config not found: %v", err) logger.Fatalf("imgflip.username config not found: %v", err)
@@ -36,7 +36,7 @@ func New() *Meme {
if len(password) == 0 { if len(password) == 0 {
logger.Fatal("imgflip.password config not found") logger.Fatal("imgflip.password config not found")
} }
return &Meme{ return &Memegen{
username: username, username: username,
password: password, password: password,
} }
@@ -51,16 +51,16 @@ type Data struct {
Memes []*pb.Template `json:"memes"` Memes []*pb.Template `json:"memes"`
} }
func (m *Meme) Templates(ctx context.Context, req *pb.TemplatesRequest, rsp *pb.TemplatesResponse) error { func (m *Memegen) Templates(ctx context.Context, req *pb.TemplatesRequest, rsp *pb.TemplatesResponse) error {
templateRsp := new(TemplateRequest) templateRsp := new(TemplateRequest)
if err := api.Get("https://api.imgflip.com/get_memes", templateRsp); err != nil { if err := api.Get("https://api.imgflip.com/get_memes", templateRsp); err != nil {
return errors.InternalServerError("meme.templates", err.Error()) return errors.InternalServerError("memegen.templates", err.Error())
} }
rsp.Templates = templateRsp.Data.Memes rsp.Templates = templateRsp.Data.Memes
return nil return nil
} }
func (m *Meme) Generate(ctx context.Context, req *pb.GenerateRequest, rsp *pb.GenerateResponse) error { func (m *Memegen) Generate(ctx context.Context, req *pb.GenerateRequest, rsp *pb.GenerateResponse) error {
vals := url.Values{} vals := url.Values{}
vals.Set("template_id", req.Id) vals.Set("template_id", req.Id)
vals.Set("text0", req.TopText) vals.Set("text0", req.TopText)
@@ -74,7 +74,7 @@ func (m *Meme) Generate(ctx context.Context, req *pb.GenerateRequest, rsp *pb.Ge
resp, err := http.PostForm("https://api.imgflip.com/caption_image", vals) resp, err := http.PostForm("https://api.imgflip.com/caption_image", vals)
if err != nil { if err != nil {
return errors.InternalServerError("meme.generate", err.Error()) return errors.InternalServerError("memegen.generate", err.Error())
} }
defer resp.Body.Close() defer resp.Body.Close()
@@ -83,7 +83,7 @@ func (m *Meme) Generate(ctx context.Context, req *pb.GenerateRequest, rsp *pb.Ge
success := genRsp["success"].(bool) success := genRsp["success"].(bool)
if !success { if !success {
return errors.BadRequest("meme.generate", genRsp["error_message"].(string)) return errors.BadRequest("memegen.generate", genRsp["error_message"].(string))
} }
// set response url // set response url

View File

@@ -3,19 +3,19 @@ package main
import ( import (
"github.com/micro/micro/v3/service" "github.com/micro/micro/v3/service"
"github.com/micro/micro/v3/service/logger" "github.com/micro/micro/v3/service/logger"
"github.com/micro/services/meme/handler" "github.com/micro/services/memegen/handler"
pb "github.com/micro/services/meme/proto" pb "github.com/micro/services/memegen/proto"
) )
func main() { func main() {
// Create service // Create service
srv := service.New( srv := service.New(
service.Name("meme"), service.Name("memegen"),
service.Version("latest"), service.Version("latest"),
) )
// Register handler // Register handler
pb.RegisterMemeHandler(srv.Server(), handler.New()) pb.RegisterMemegenHandler(srv.Server(), handler.New())
// Run service // Run service
if err := srv.Run(); err != nil { if err := srv.Run(); err != nil {

1
memegen/micro.mu Normal file
View File

@@ -0,0 +1 @@
service memegen

View File

@@ -2,9 +2,9 @@
// versions: // versions:
// protoc-gen-go v1.27.1 // protoc-gen-go v1.27.1
// protoc v3.15.6 // protoc v3.15.6
// source: proto/meme.proto // source: proto/memegen.proto
package meme package memegen
import ( import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@@ -25,11 +25,11 @@ type Template struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// id of the meme // id of the memegen
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// name of the meme // name of the memegen
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
// url of the meme // url of the memegen
Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"` Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
// width in pixels // width in pixels
Width int32 `protobuf:"varint,4,opt,name=width,proto3" json:"width,omitempty"` Width int32 `protobuf:"varint,4,opt,name=width,proto3" json:"width,omitempty"`
@@ -42,7 +42,7 @@ type Template struct {
func (x *Template) Reset() { func (x *Template) Reset() {
*x = Template{} *x = Template{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_meme_proto_msgTypes[0] mi := &file_proto_memegen_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -55,7 +55,7 @@ func (x *Template) String() string {
func (*Template) ProtoMessage() {} func (*Template) ProtoMessage() {}
func (x *Template) ProtoReflect() protoreflect.Message { func (x *Template) ProtoReflect() protoreflect.Message {
mi := &file_proto_meme_proto_msgTypes[0] mi := &file_proto_memegen_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -68,7 +68,7 @@ func (x *Template) ProtoReflect() protoreflect.Message {
// Deprecated: Use Template.ProtoReflect.Descriptor instead. // Deprecated: Use Template.ProtoReflect.Descriptor instead.
func (*Template) Descriptor() ([]byte, []int) { func (*Template) Descriptor() ([]byte, []int) {
return file_proto_meme_proto_rawDescGZIP(), []int{0} return file_proto_memegen_proto_rawDescGZIP(), []int{0}
} }
func (x *Template) GetId() string { func (x *Template) GetId() string {
@@ -137,7 +137,7 @@ type Box struct {
func (x *Box) Reset() { func (x *Box) Reset() {
*x = Box{} *x = Box{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_meme_proto_msgTypes[1] mi := &file_proto_memegen_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -150,7 +150,7 @@ func (x *Box) String() string {
func (*Box) ProtoMessage() {} func (*Box) ProtoMessage() {}
func (x *Box) ProtoReflect() protoreflect.Message { func (x *Box) ProtoReflect() protoreflect.Message {
mi := &file_proto_meme_proto_msgTypes[1] mi := &file_proto_memegen_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -163,7 +163,7 @@ func (x *Box) ProtoReflect() protoreflect.Message {
// Deprecated: Use Box.ProtoReflect.Descriptor instead. // Deprecated: Use Box.ProtoReflect.Descriptor instead.
func (*Box) Descriptor() ([]byte, []int) { func (*Box) Descriptor() ([]byte, []int) {
return file_proto_meme_proto_rawDescGZIP(), []int{1} return file_proto_memegen_proto_rawDescGZIP(), []int{1}
} }
func (x *Box) GetText() string { func (x *Box) GetText() string {
@@ -225,7 +225,7 @@ type TemplatesRequest struct {
func (x *TemplatesRequest) Reset() { func (x *TemplatesRequest) Reset() {
*x = TemplatesRequest{} *x = TemplatesRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_meme_proto_msgTypes[2] mi := &file_proto_memegen_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -238,7 +238,7 @@ func (x *TemplatesRequest) String() string {
func (*TemplatesRequest) ProtoMessage() {} func (*TemplatesRequest) ProtoMessage() {}
func (x *TemplatesRequest) ProtoReflect() protoreflect.Message { func (x *TemplatesRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_meme_proto_msgTypes[2] mi := &file_proto_memegen_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -251,7 +251,7 @@ func (x *TemplatesRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use TemplatesRequest.ProtoReflect.Descriptor instead. // Deprecated: Use TemplatesRequest.ProtoReflect.Descriptor instead.
func (*TemplatesRequest) Descriptor() ([]byte, []int) { func (*TemplatesRequest) Descriptor() ([]byte, []int) {
return file_proto_meme_proto_rawDescGZIP(), []int{2} return file_proto_memegen_proto_rawDescGZIP(), []int{2}
} }
type TemplatesResponse struct { type TemplatesResponse struct {
@@ -265,7 +265,7 @@ type TemplatesResponse struct {
func (x *TemplatesResponse) Reset() { func (x *TemplatesResponse) Reset() {
*x = TemplatesResponse{} *x = TemplatesResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_meme_proto_msgTypes[3] mi := &file_proto_memegen_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -278,7 +278,7 @@ func (x *TemplatesResponse) String() string {
func (*TemplatesResponse) ProtoMessage() {} func (*TemplatesResponse) ProtoMessage() {}
func (x *TemplatesResponse) ProtoReflect() protoreflect.Message { func (x *TemplatesResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_meme_proto_msgTypes[3] mi := &file_proto_memegen_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -291,7 +291,7 @@ func (x *TemplatesResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use TemplatesResponse.ProtoReflect.Descriptor instead. // Deprecated: Use TemplatesResponse.ProtoReflect.Descriptor instead.
func (*TemplatesResponse) Descriptor() ([]byte, []int) { func (*TemplatesResponse) Descriptor() ([]byte, []int) {
return file_proto_meme_proto_rawDescGZIP(), []int{3} return file_proto_memegen_proto_rawDescGZIP(), []int{3}
} }
func (x *TemplatesResponse) GetTemplates() []*Template { func (x *TemplatesResponse) GetTemplates() []*Template {
@@ -321,7 +321,7 @@ type GenerateRequest struct {
func (x *GenerateRequest) Reset() { func (x *GenerateRequest) Reset() {
*x = GenerateRequest{} *x = GenerateRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_meme_proto_msgTypes[4] mi := &file_proto_memegen_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -334,7 +334,7 @@ func (x *GenerateRequest) String() string {
func (*GenerateRequest) ProtoMessage() {} func (*GenerateRequest) ProtoMessage() {}
func (x *GenerateRequest) ProtoReflect() protoreflect.Message { func (x *GenerateRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_meme_proto_msgTypes[4] mi := &file_proto_memegen_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -347,7 +347,7 @@ func (x *GenerateRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GenerateRequest.ProtoReflect.Descriptor instead. // Deprecated: Use GenerateRequest.ProtoReflect.Descriptor instead.
func (*GenerateRequest) Descriptor() ([]byte, []int) { func (*GenerateRequest) Descriptor() ([]byte, []int) {
return file_proto_meme_proto_rawDescGZIP(), []int{4} return file_proto_memegen_proto_rawDescGZIP(), []int{4}
} }
func (x *GenerateRequest) GetId() string { func (x *GenerateRequest) GetId() string {
@@ -390,14 +390,14 @@ type GenerateResponse struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// url of the meme // url of the memegen
Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
} }
func (x *GenerateResponse) Reset() { func (x *GenerateResponse) Reset() {
*x = GenerateResponse{} *x = GenerateResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_meme_proto_msgTypes[5] mi := &file_proto_memegen_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -410,7 +410,7 @@ func (x *GenerateResponse) String() string {
func (*GenerateResponse) ProtoMessage() {} func (*GenerateResponse) ProtoMessage() {}
func (x *GenerateResponse) ProtoReflect() protoreflect.Message { func (x *GenerateResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_meme_proto_msgTypes[5] mi := &file_proto_memegen_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -423,7 +423,7 @@ func (x *GenerateResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GenerateResponse.ProtoReflect.Descriptor instead. // Deprecated: Use GenerateResponse.ProtoReflect.Descriptor instead.
func (*GenerateResponse) Descriptor() ([]byte, []int) { func (*GenerateResponse) Descriptor() ([]byte, []int) {
return file_proto_meme_proto_rawDescGZIP(), []int{5} return file_proto_memegen_proto_rawDescGZIP(), []int{5}
} }
func (x *GenerateResponse) GetUrl() string { func (x *GenerateResponse) GetUrl() string {
@@ -433,85 +433,87 @@ func (x *GenerateResponse) GetUrl() string {
return "" return ""
} }
var File_proto_meme_proto protoreflect.FileDescriptor var File_proto_memegen_proto protoreflect.FileDescriptor
var file_proto_meme_proto_rawDesc = []byte{ var file_proto_memegen_proto_rawDesc = []byte{
0x0a, 0x10, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x65, 0x6d, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x0a, 0x13, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x65, 0x6d, 0x65, 0x67, 0x65, 0x6e, 0x2e,
0x74, 0x6f, 0x12, 0x04, 0x6d, 0x65, 0x6d, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x08, 0x54, 0x65, 0x6d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6d, 0x65, 0x6d, 0x65, 0x67, 0x65, 0x6e, 0x22, 0x8b,
0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x0a, 0x08, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72,
0x69, 0x64, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05,
0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68,
0x05, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x6f, 0x78, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12,
0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x62, 0x6f, 0x1b, 0x0a, 0x09, 0x62, 0x6f, 0x78, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01,
0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x03, 0x42, 0x6f, 0x78, 0x12, 0x12, 0x28, 0x05, 0x52, 0x08, 0x62, 0x6f, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, 0x0a,
0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x03, 0x42, 0x6f, 0x78, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01,
0x78, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x02, 0x20,
0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x12, 0x14, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28,
0x0a, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x77, 0x05, 0x52, 0x01, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x04, 0x20,
0x69, 0x64, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x01, 0x28, 0x05, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65,
0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67,
0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28,
0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x07, 0x20, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x6c,
0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x75, 0x74, 0x6c, 0x69, 0x6e, 0x65, 0x22, 0x12, 0x0a, 0x10, 0x69, 0x6e, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x75, 0x74, 0x6c, 0x69,
0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x22, 0x12, 0x0a, 0x10, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52,
0x22, 0x41, 0x0a, 0x11, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x44, 0x0a, 0x11, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x09, 0x74,
0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x65, 0x6d, 0x65, 0x2e, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11,
0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x09, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x2e, 0x6d, 0x65, 0x6d, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74,
0x74, 0x65, 0x73, 0x22, 0x95, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x65, 0x52, 0x09, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x22, 0x95, 0x01, 0x0a,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x0f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x6f, 0x70, 0x5f, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x6f, 0x70, 0x54, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x6f, 0x70, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01,
0x78, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x28, 0x09, 0x52, 0x07, 0x74, 0x6f, 0x70, 0x54, 0x65, 0x78, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x62,
0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x54, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6f, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x52, 0x0a, 0x62, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x54, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04,
0x09, 0x52, 0x04, 0x66, 0x6f, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x5f, 0x66, 0x66, 0x6f, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6f, 0x6e, 0x74,
0x6f, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x12, 0x22, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x5f, 0x66, 0x6f, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a,
0x6d, 0x61, 0x78, 0x46, 0x6f, 0x6e, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x24, 0x0a, 0x10, 0x47, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x61, 0x78, 0x46, 0x6f, 0x6e, 0x74,
0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x24, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,
0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18,
0x6c, 0x32, 0x83, 0x01, 0x0a, 0x04, 0x4d, 0x65, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x09, 0x54, 0x65, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x32, 0x92, 0x01, 0x0a, 0x07, 0x4d,
0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x12, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x65, 0x2e, 0x54, 0x65, 0x6d, 0x65, 0x67, 0x65, 0x6e, 0x12, 0x44, 0x0a, 0x09, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61,
0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x74, 0x65, 0x73, 0x12, 0x19, 0x2e, 0x6d, 0x65, 0x6d, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x54, 0x65,
0x17, 0x2e, 0x6d, 0x65, 0x6d, 0x65, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x08, 0x47, 0x65, 0x2e, 0x6d, 0x65, 0x6d, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74,
0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x6d, 0x65, 0x6d, 0x65, 0x2e, 0x47, 0x65, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x08,
0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x18, 0x2e, 0x6d, 0x65, 0x6d, 0x65, 0x67,
0x6d, 0x65, 0x6d, 0x65, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x65, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6d, 0x65, 0x6d, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x47, 0x65, 0x6e,
0x74, 0x6f, 0x3b, 0x6d, 0x65, 0x6d, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42,
0x11, 0x5a, 0x0f, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x6d, 0x65, 0x6d, 0x65, 0x67,
0x65, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
file_proto_meme_proto_rawDescOnce sync.Once file_proto_memegen_proto_rawDescOnce sync.Once
file_proto_meme_proto_rawDescData = file_proto_meme_proto_rawDesc file_proto_memegen_proto_rawDescData = file_proto_memegen_proto_rawDesc
) )
func file_proto_meme_proto_rawDescGZIP() []byte { func file_proto_memegen_proto_rawDescGZIP() []byte {
file_proto_meme_proto_rawDescOnce.Do(func() { file_proto_memegen_proto_rawDescOnce.Do(func() {
file_proto_meme_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_meme_proto_rawDescData) file_proto_memegen_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_memegen_proto_rawDescData)
}) })
return file_proto_meme_proto_rawDescData return file_proto_memegen_proto_rawDescData
} }
var file_proto_meme_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_proto_memegen_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_proto_meme_proto_goTypes = []interface{}{ var file_proto_memegen_proto_goTypes = []interface{}{
(*Template)(nil), // 0: meme.Template (*Template)(nil), // 0: memegen.Template
(*Box)(nil), // 1: meme.Box (*Box)(nil), // 1: memegen.Box
(*TemplatesRequest)(nil), // 2: meme.TemplatesRequest (*TemplatesRequest)(nil), // 2: memegen.TemplatesRequest
(*TemplatesResponse)(nil), // 3: meme.TemplatesResponse (*TemplatesResponse)(nil), // 3: memegen.TemplatesResponse
(*GenerateRequest)(nil), // 4: meme.GenerateRequest (*GenerateRequest)(nil), // 4: memegen.GenerateRequest
(*GenerateResponse)(nil), // 5: meme.GenerateResponse (*GenerateResponse)(nil), // 5: memegen.GenerateResponse
} }
var file_proto_meme_proto_depIdxs = []int32{ var file_proto_memegen_proto_depIdxs = []int32{
0, // 0: meme.TemplatesResponse.templates:type_name -> meme.Template 0, // 0: memegen.TemplatesResponse.templates:type_name -> memegen.Template
2, // 1: meme.Meme.Templates:input_type -> meme.TemplatesRequest 2, // 1: memegen.Memegen.Templates:input_type -> memegen.TemplatesRequest
4, // 2: meme.Meme.Generate:input_type -> meme.GenerateRequest 4, // 2: memegen.Memegen.Generate:input_type -> memegen.GenerateRequest
3, // 3: meme.Meme.Templates:output_type -> meme.TemplatesResponse 3, // 3: memegen.Memegen.Templates:output_type -> memegen.TemplatesResponse
5, // 4: meme.Meme.Generate:output_type -> meme.GenerateResponse 5, // 4: memegen.Memegen.Generate:output_type -> memegen.GenerateResponse
3, // [3:5] is the sub-list for method output_type 3, // [3:5] is the sub-list for method output_type
1, // [1:3] is the sub-list for method input_type 1, // [1:3] 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 type_name
@@ -519,13 +521,13 @@ var file_proto_meme_proto_depIdxs = []int32{
0, // [0:1] is the sub-list for field type_name 0, // [0:1] is the sub-list for field type_name
} }
func init() { file_proto_meme_proto_init() } func init() { file_proto_memegen_proto_init() }
func file_proto_meme_proto_init() { func file_proto_memegen_proto_init() {
if File_proto_meme_proto != nil { if File_proto_memegen_proto != nil {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_proto_meme_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_proto_memegen_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Template); i { switch v := v.(*Template); i {
case 0: case 0:
return &v.state return &v.state
@@ -537,7 +539,7 @@ func file_proto_meme_proto_init() {
return nil return nil
} }
} }
file_proto_meme_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { file_proto_memegen_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Box); i { switch v := v.(*Box); i {
case 0: case 0:
return &v.state return &v.state
@@ -549,7 +551,7 @@ func file_proto_meme_proto_init() {
return nil return nil
} }
} }
file_proto_meme_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { file_proto_memegen_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TemplatesRequest); i { switch v := v.(*TemplatesRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -561,7 +563,7 @@ func file_proto_meme_proto_init() {
return nil return nil
} }
} }
file_proto_meme_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { file_proto_memegen_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TemplatesResponse); i { switch v := v.(*TemplatesResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -573,7 +575,7 @@ func file_proto_meme_proto_init() {
return nil return nil
} }
} }
file_proto_meme_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { file_proto_memegen_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GenerateRequest); i { switch v := v.(*GenerateRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -585,7 +587,7 @@ func file_proto_meme_proto_init() {
return nil return nil
} }
} }
file_proto_meme_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_proto_memegen_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GenerateResponse); i { switch v := v.(*GenerateResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -602,18 +604,18 @@ func file_proto_meme_proto_init() {
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_proto_meme_proto_rawDesc, RawDescriptor: file_proto_memegen_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 6, NumMessages: 6,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },
GoTypes: file_proto_meme_proto_goTypes, GoTypes: file_proto_memegen_proto_goTypes,
DependencyIndexes: file_proto_meme_proto_depIdxs, DependencyIndexes: file_proto_memegen_proto_depIdxs,
MessageInfos: file_proto_meme_proto_msgTypes, MessageInfos: file_proto_memegen_proto_msgTypes,
}.Build() }.Build()
File_proto_meme_proto = out.File File_proto_memegen_proto = out.File
file_proto_meme_proto_rawDesc = nil file_proto_memegen_proto_rawDesc = nil
file_proto_meme_proto_goTypes = nil file_proto_memegen_proto_goTypes = nil
file_proto_meme_proto_depIdxs = nil file_proto_memegen_proto_depIdxs = nil
} }

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-micro. DO NOT EDIT. // Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/meme.proto // source: proto/memegen.proto
package meme package memegen
import ( import (
fmt "fmt" fmt "fmt"
@@ -33,33 +33,33 @@ var _ context.Context
var _ client.Option var _ client.Option
var _ server.Option var _ server.Option
// Api Endpoints for Meme service // Api Endpoints for Memegen service
func NewMemeEndpoints() []*api.Endpoint { func NewMemegenEndpoints() []*api.Endpoint {
return []*api.Endpoint{} return []*api.Endpoint{}
} }
// Client API for Meme service // Client API for Memegen service
type MemeService interface { type MemegenService interface {
Templates(ctx context.Context, in *TemplatesRequest, opts ...client.CallOption) (*TemplatesResponse, error) Templates(ctx context.Context, in *TemplatesRequest, opts ...client.CallOption) (*TemplatesResponse, error)
Generate(ctx context.Context, in *GenerateRequest, opts ...client.CallOption) (*GenerateResponse, error) Generate(ctx context.Context, in *GenerateRequest, opts ...client.CallOption) (*GenerateResponse, error)
} }
type memeService struct { type memegenService struct {
c client.Client c client.Client
name string name string
} }
func NewMemeService(name string, c client.Client) MemeService { func NewMemegenService(name string, c client.Client) MemegenService {
return &memeService{ return &memegenService{
c: c, c: c,
name: name, name: name,
} }
} }
func (c *memeService) Templates(ctx context.Context, in *TemplatesRequest, opts ...client.CallOption) (*TemplatesResponse, error) { func (c *memegenService) Templates(ctx context.Context, in *TemplatesRequest, opts ...client.CallOption) (*TemplatesResponse, error) {
req := c.c.NewRequest(c.name, "Meme.Templates", in) req := c.c.NewRequest(c.name, "Memegen.Templates", in)
out := new(TemplatesResponse) out := new(TemplatesResponse)
err := c.c.Call(ctx, req, out, opts...) err := c.c.Call(ctx, req, out, opts...)
if err != nil { if err != nil {
@@ -68,8 +68,8 @@ func (c *memeService) Templates(ctx context.Context, in *TemplatesRequest, opts
return out, nil return out, nil
} }
func (c *memeService) Generate(ctx context.Context, in *GenerateRequest, opts ...client.CallOption) (*GenerateResponse, error) { func (c *memegenService) Generate(ctx context.Context, in *GenerateRequest, opts ...client.CallOption) (*GenerateResponse, error) {
req := c.c.NewRequest(c.name, "Meme.Generate", in) req := c.c.NewRequest(c.name, "Memegen.Generate", in)
out := new(GenerateResponse) out := new(GenerateResponse)
err := c.c.Call(ctx, req, out, opts...) err := c.c.Call(ctx, req, out, opts...)
if err != nil { if err != nil {
@@ -78,33 +78,33 @@ func (c *memeService) Generate(ctx context.Context, in *GenerateRequest, opts ..
return out, nil return out, nil
} }
// Server API for Meme service // Server API for Memegen service
type MemeHandler interface { type MemegenHandler interface {
Templates(context.Context, *TemplatesRequest, *TemplatesResponse) error Templates(context.Context, *TemplatesRequest, *TemplatesResponse) error
Generate(context.Context, *GenerateRequest, *GenerateResponse) error Generate(context.Context, *GenerateRequest, *GenerateResponse) error
} }
func RegisterMemeHandler(s server.Server, hdlr MemeHandler, opts ...server.HandlerOption) error { func RegisterMemegenHandler(s server.Server, hdlr MemegenHandler, opts ...server.HandlerOption) error {
type meme interface { type memegen interface {
Templates(ctx context.Context, in *TemplatesRequest, out *TemplatesResponse) error Templates(ctx context.Context, in *TemplatesRequest, out *TemplatesResponse) error
Generate(ctx context.Context, in *GenerateRequest, out *GenerateResponse) error Generate(ctx context.Context, in *GenerateRequest, out *GenerateResponse) error
} }
type Meme struct { type Memegen struct {
meme memegen
} }
h := &memeHandler{hdlr} h := &memegenHandler{hdlr}
return s.Handle(s.NewHandler(&Meme{h}, opts...)) return s.Handle(s.NewHandler(&Memegen{h}, opts...))
} }
type memeHandler struct { type memegenHandler struct {
MemeHandler MemegenHandler
} }
func (h *memeHandler) Templates(ctx context.Context, in *TemplatesRequest, out *TemplatesResponse) error { func (h *memegenHandler) Templates(ctx context.Context, in *TemplatesRequest, out *TemplatesResponse) error {
return h.MemeHandler.Templates(ctx, in, out) return h.MemegenHandler.Templates(ctx, in, out)
} }
func (h *memeHandler) Generate(ctx context.Context, in *GenerateRequest, out *GenerateResponse) error { func (h *memegenHandler) Generate(ctx context.Context, in *GenerateRequest, out *GenerateResponse) error {
return h.MemeHandler.Generate(ctx, in, out) return h.MemegenHandler.Generate(ctx, in, out)
} }

View File

@@ -1,20 +1,20 @@
syntax = "proto3"; syntax = "proto3";
package meme; package memegen;
option go_package = "./proto;meme"; option go_package = "./proto;memegen";
service Meme { service Memegen {
rpc Templates(TemplatesRequest) returns (TemplatesResponse) {} rpc Templates(TemplatesRequest) returns (TemplatesResponse) {}
rpc Generate(GenerateRequest) returns (GenerateResponse) {} rpc Generate(GenerateRequest) returns (GenerateResponse) {}
} }
message Template { message Template {
// id of the meme // id of the memegen
string id = 1; string id = 1;
// name of the meme // name of the memegen
string name = 2; string name = 2;
// url of the meme // url of the memegen
string url = 3; string url = 3;
// width in pixels // width in pixels
int32 width = 4; int32 width = 4;
@@ -62,7 +62,7 @@ message GenerateRequest {
} }
message GenerateResponse { message GenerateResponse {
// url of the meme // url of the memegen
string url = 1; string url = 1;
} }

6
memegen/publicapi.json Normal file
View File

@@ -0,0 +1,6 @@
{
"name": "memegen",
"icon": "🤦",
"category": "social",
"display_name": "Memegen Generator"
}