mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 03:05:14 +00:00
111 lines
3.0 KiB
Go
111 lines
3.0 KiB
Go
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
|
// source: proto/otp.proto
|
|
|
|
package otp
|
|
|
|
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 Otp service
|
|
|
|
func NewOtpEndpoints() []*api.Endpoint {
|
|
return []*api.Endpoint{}
|
|
}
|
|
|
|
// Client API for Otp service
|
|
|
|
type OtpService interface {
|
|
Generate(ctx context.Context, in *GenerateRequest, opts ...client.CallOption) (*GenerateResponse, error)
|
|
Validate(ctx context.Context, in *ValidateRequest, opts ...client.CallOption) (*ValidateResponse, error)
|
|
}
|
|
|
|
type otpService struct {
|
|
c client.Client
|
|
name string
|
|
}
|
|
|
|
func NewOtpService(name string, c client.Client) OtpService {
|
|
return &otpService{
|
|
c: c,
|
|
name: name,
|
|
}
|
|
}
|
|
|
|
func (c *otpService) Generate(ctx context.Context, in *GenerateRequest, opts ...client.CallOption) (*GenerateResponse, error) {
|
|
req := c.c.NewRequest(c.name, "Otp.Generate", in)
|
|
out := new(GenerateResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *otpService) Validate(ctx context.Context, in *ValidateRequest, opts ...client.CallOption) (*ValidateResponse, error) {
|
|
req := c.c.NewRequest(c.name, "Otp.Validate", in)
|
|
out := new(ValidateResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// Server API for Otp service
|
|
|
|
type OtpHandler interface {
|
|
Generate(context.Context, *GenerateRequest, *GenerateResponse) error
|
|
Validate(context.Context, *ValidateRequest, *ValidateResponse) error
|
|
}
|
|
|
|
func RegisterOtpHandler(s server.Server, hdlr OtpHandler, opts ...server.HandlerOption) error {
|
|
type otp interface {
|
|
Generate(ctx context.Context, in *GenerateRequest, out *GenerateResponse) error
|
|
Validate(ctx context.Context, in *ValidateRequest, out *ValidateResponse) error
|
|
}
|
|
type Otp struct {
|
|
otp
|
|
}
|
|
h := &otpHandler{hdlr}
|
|
return s.Handle(s.NewHandler(&Otp{h}, opts...))
|
|
}
|
|
|
|
type otpHandler struct {
|
|
OtpHandler
|
|
}
|
|
|
|
func (h *otpHandler) Generate(ctx context.Context, in *GenerateRequest, out *GenerateResponse) error {
|
|
return h.OtpHandler.Generate(ctx, in, out)
|
|
}
|
|
|
|
func (h *otpHandler) Validate(ctx context.Context, in *ValidateRequest, out *ValidateResponse) error {
|
|
return h.OtpHandler.Validate(ctx, in, out)
|
|
}
|