sms

package
v0.0.0-...-74b4404 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package sms is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	SmsChannel_name = map[int32]string{
		0: "Test",
		1: "AliYun",
	}
	SmsChannel_value = map[string]int32{
		"Test":   0,
		"AliYun": 1,
	}
)

Enum value maps for SmsChannel.

View Source
var File_jmash_sms_resources_proto protoreflect.FileDescriptor
View Source
var File_jmash_sms_service_proto protoreflect.FileDescriptor
View Source
var Sms_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "jmash.sms.Sms",
	HandlerType: (*SmsServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SendSms",
			Handler:    _Sms_SendSms_Handler,
		},
		{
			MethodName: "SendCaptcha",
			Handler:    _Sms_SendCaptcha_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "jmash/sms/service.proto",
}

Sms_ServiceDesc is the grpc.ServiceDesc for Sms service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterSmsHandler

func RegisterSmsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterSmsHandler registers the http handlers for service Sms to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterSmsHandlerClient

func RegisterSmsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SmsClient) error

RegisterSmsHandlerClient registers the http handlers for service Sms to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SmsClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SmsClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "SmsClient" to call the correct interceptors.

func RegisterSmsHandlerFromEndpoint

func RegisterSmsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterSmsHandlerFromEndpoint is same as RegisterSmsHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterSmsHandlerServer

func RegisterSmsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SmsServer) error

RegisterSmsHandlerServer registers the http handlers for service Sms to "mux". UnaryRPC :call SmsServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSmsHandlerFromEndpoint instead.

func RegisterSmsServer

func RegisterSmsServer(s grpc.ServiceRegistrar, srv SmsServer)

Types

type BoolValue

type BoolValue = wrapperspb.BoolValue

type BytesValue

type BytesValue = wrapperspb.BytesValue

type DoubleValue

type DoubleValue = wrapperspb.DoubleValue

type FloatValue

type FloatValue = wrapperspb.FloatValue

type Int32Value

type Int32Value = wrapperspb.Int32Value

type Int64Value

type Int64Value = wrapperspb.Int64Value

type SendCaptchaReq

type SendCaptchaReq struct {

	// 手机号
	MobilePhone string `protobuf:"bytes,1,opt,name=mobile_phone,json=mobilePhone,proto3" json:"mobile_phone,omitempty"`
	// 短信签名
	SmsSignature string `protobuf:"bytes,2,opt,name=sms_signature,json=smsSignature,proto3" json:"sms_signature,omitempty"`
	// 验证码
	Captcha string `protobuf:"bytes,3,opt,name=captcha,proto3" json:"captcha,omitempty"`
	// 短信通道
	SmsChannel SmsChannel `protobuf:"varint,4,opt,name=sms_channel,json=smsChannel,proto3,enum=jmash.sms.SmsChannel" json:"sms_channel,omitempty"`
	// contains filtered or unexported fields
}

发送短信验证码

func (*SendCaptchaReq) Descriptor deprecated

func (*SendCaptchaReq) Descriptor() ([]byte, []int)

Deprecated: Use SendCaptchaReq.ProtoReflect.Descriptor instead.

func (*SendCaptchaReq) GetCaptcha

func (x *SendCaptchaReq) GetCaptcha() string

func (*SendCaptchaReq) GetMobilePhone

func (x *SendCaptchaReq) GetMobilePhone() string

func (*SendCaptchaReq) GetSmsChannel

func (x *SendCaptchaReq) GetSmsChannel() SmsChannel

func (*SendCaptchaReq) GetSmsSignature

func (x *SendCaptchaReq) GetSmsSignature() string

func (*SendCaptchaReq) ProtoMessage

func (*SendCaptchaReq) ProtoMessage()

func (*SendCaptchaReq) ProtoReflect

func (x *SendCaptchaReq) ProtoReflect() protoreflect.Message

func (*SendCaptchaReq) Reset

func (x *SendCaptchaReq) Reset()

func (*SendCaptchaReq) String

func (x *SendCaptchaReq) String() string

type SendSmsReq

type SendSmsReq struct {

	// 手机号
	MobilePhone string `protobuf:"bytes,1,opt,name=mobile_phone,json=mobilePhone,proto3" json:"mobile_phone,omitempty"`
	// 短信签名
	SmsSignature string `protobuf:"bytes,2,opt,name=sms_signature,json=smsSignature,proto3" json:"sms_signature,omitempty"`
	// 短信模板ID
	TemplateId string `protobuf:"bytes,3,opt,name=template_id,json=templateId,proto3" json:"template_id,omitempty"`
	// 参数
	Params map[string]string `` /* 153-byte string literal not displayed */
	// 短信通道
	SmsChannel SmsChannel `protobuf:"varint,5,opt,name=sms_channel,json=smsChannel,proto3,enum=jmash.sms.SmsChannel" json:"sms_channel,omitempty"`
	// contains filtered or unexported fields
}

发送短信(通用)

func (*SendSmsReq) Descriptor deprecated

func (*SendSmsReq) Descriptor() ([]byte, []int)

Deprecated: Use SendSmsReq.ProtoReflect.Descriptor instead.

func (*SendSmsReq) GetMobilePhone

func (x *SendSmsReq) GetMobilePhone() string

func (*SendSmsReq) GetParams

func (x *SendSmsReq) GetParams() map[string]string

func (*SendSmsReq) GetSmsChannel

func (x *SendSmsReq) GetSmsChannel() SmsChannel

func (*SendSmsReq) GetSmsSignature

func (x *SendSmsReq) GetSmsSignature() string

func (*SendSmsReq) GetTemplateId

func (x *SendSmsReq) GetTemplateId() string

func (*SendSmsReq) ProtoMessage

func (*SendSmsReq) ProtoMessage()

func (*SendSmsReq) ProtoReflect

func (x *SendSmsReq) ProtoReflect() protoreflect.Message

func (*SendSmsReq) Reset

func (x *SendSmsReq) Reset()

func (*SendSmsReq) String

func (x *SendSmsReq) String() string

type SmsChannel

type SmsChannel int32

短信通道

const (
	SmsChannel_Test   SmsChannel = 0
	SmsChannel_AliYun SmsChannel = 1
)

func (SmsChannel) Descriptor

func (SmsChannel) Descriptor() protoreflect.EnumDescriptor

func (SmsChannel) Enum

func (x SmsChannel) Enum() *SmsChannel

func (SmsChannel) EnumDescriptor deprecated

func (SmsChannel) EnumDescriptor() ([]byte, []int)

Deprecated: Use SmsChannel.Descriptor instead.

func (SmsChannel) Number

func (x SmsChannel) Number() protoreflect.EnumNumber

func (SmsChannel) String

func (x SmsChannel) String() string

func (SmsChannel) Type

type SmsClient

type SmsClient interface {
	// 发送短信
	SendSms(ctx context.Context, in *SendSmsReq, opts ...grpc.CallOption) (*wrapperspb.BoolValue, error)
	// 发送短信验证码
	SendCaptcha(ctx context.Context, in *SendCaptchaReq, opts ...grpc.CallOption) (*wrapperspb.BoolValue, error)
}

SmsClient is the client API for Sms service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewSmsClient

func NewSmsClient(cc grpc.ClientConnInterface) SmsClient

type SmsServer

type SmsServer interface {
	// 发送短信
	SendSms(context.Context, *SendSmsReq) (*wrapperspb.BoolValue, error)
	// 发送短信验证码
	SendCaptcha(context.Context, *SendCaptchaReq) (*wrapperspb.BoolValue, error)
	// contains filtered or unexported methods
}

SmsServer is the server API for Sms service. All implementations must embed UnimplementedSmsServer for forward compatibility

type StringValue

type StringValue = wrapperspb.StringValue

type UInt32Value

type UInt32Value = wrapperspb.UInt32Value

type UInt64Value

type UInt64Value = wrapperspb.UInt64Value

type UnimplementedSmsServer

type UnimplementedSmsServer struct {
}

UnimplementedSmsServer must be embedded to have forward compatible implementations.

func (UnimplementedSmsServer) SendCaptcha

func (UnimplementedSmsServer) SendSms

type UnsafeSmsServer

type UnsafeSmsServer interface {
	// contains filtered or unexported methods
}

UnsafeSmsServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SmsServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL