mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 19:25:16 +00:00
128 lines
3.5 KiB
Go
128 lines
3.5 KiB
Go
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
|
// source: proto/mail.proto
|
|
|
|
package mail
|
|
|
|
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 Mail service
|
|
|
|
func NewMailEndpoints() []*api.Endpoint {
|
|
return []*api.Endpoint{}
|
|
}
|
|
|
|
// Client API for Mail service
|
|
|
|
type MailService interface {
|
|
Send(ctx context.Context, in *SendRequest, opts ...client.CallOption) (*SendResponse, error)
|
|
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
|
|
Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
|
|
}
|
|
|
|
type mailService struct {
|
|
c client.Client
|
|
name string
|
|
}
|
|
|
|
func NewMailService(name string, c client.Client) MailService {
|
|
return &mailService{
|
|
c: c,
|
|
name: name,
|
|
}
|
|
}
|
|
|
|
func (c *mailService) Send(ctx context.Context, in *SendRequest, opts ...client.CallOption) (*SendResponse, error) {
|
|
req := c.c.NewRequest(c.name, "Mail.Send", in)
|
|
out := new(SendResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *mailService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
|
|
req := c.c.NewRequest(c.name, "Mail.List", in)
|
|
out := new(ListResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *mailService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) {
|
|
req := c.c.NewRequest(c.name, "Mail.Read", in)
|
|
out := new(ReadResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// Server API for Mail service
|
|
|
|
type MailHandler interface {
|
|
Send(context.Context, *SendRequest, *SendResponse) error
|
|
List(context.Context, *ListRequest, *ListResponse) error
|
|
Read(context.Context, *ReadRequest, *ReadResponse) error
|
|
}
|
|
|
|
func RegisterMailHandler(s server.Server, hdlr MailHandler, opts ...server.HandlerOption) error {
|
|
type mail interface {
|
|
Send(ctx context.Context, in *SendRequest, out *SendResponse) error
|
|
List(ctx context.Context, in *ListRequest, out *ListResponse) error
|
|
Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
|
|
}
|
|
type Mail struct {
|
|
mail
|
|
}
|
|
h := &mailHandler{hdlr}
|
|
return s.Handle(s.NewHandler(&Mail{h}, opts...))
|
|
}
|
|
|
|
type mailHandler struct {
|
|
MailHandler
|
|
}
|
|
|
|
func (h *mailHandler) Send(ctx context.Context, in *SendRequest, out *SendResponse) error {
|
|
return h.MailHandler.Send(ctx, in, out)
|
|
}
|
|
|
|
func (h *mailHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
|
|
return h.MailHandler.List(ctx, in, out)
|
|
}
|
|
|
|
func (h *mailHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error {
|
|
return h.MailHandler.Read(ctx, in, out)
|
|
}
|