Documentation ¶
Overview ¶
Package sms is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterSmsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterSmsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SmsClient) error
- func RegisterSmsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterSmsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SmsServer) error
- func RegisterSmsServer(s grpc.ServiceRegistrar, srv SmsServer)
- type BoolValue
- type BytesValue
- type DoubleValue
- type FloatValue
- type Int32Value
- type Int64Value
- type SendCaptchaReq
- func (*SendCaptchaReq) Descriptor() ([]byte, []int)deprecated
- func (x *SendCaptchaReq) GetCaptcha() string
- func (x *SendCaptchaReq) GetMobilePhone() string
- func (x *SendCaptchaReq) GetSmsChannel() SmsChannel
- func (x *SendCaptchaReq) GetSmsSignature() string
- func (*SendCaptchaReq) ProtoMessage()
- func (x *SendCaptchaReq) ProtoReflect() protoreflect.Message
- func (x *SendCaptchaReq) Reset()
- func (x *SendCaptchaReq) String() string
- type SendSmsReq
- func (*SendSmsReq) Descriptor() ([]byte, []int)deprecated
- func (x *SendSmsReq) GetMobilePhone() string
- func (x *SendSmsReq) GetParams() map[string]string
- func (x *SendSmsReq) GetSmsChannel() SmsChannel
- func (x *SendSmsReq) GetSmsSignature() string
- func (x *SendSmsReq) GetTemplateId() string
- func (*SendSmsReq) ProtoMessage()
- func (x *SendSmsReq) ProtoReflect() protoreflect.Message
- func (x *SendSmsReq) Reset()
- func (x *SendSmsReq) String() string
- type SmsChannel
- type SmsClient
- type SmsServer
- type StringValue
- type UInt32Value
- type UInt64Value
- type UnimplementedSmsServer
- type UnsafeSmsServer
Constants ¶
This section is empty.
Variables ¶
var ( SmsChannel_name = map[int32]string{ 0: "Test", 1: "AliYun", } SmsChannel_value = map[string]int32{ "Test": 0, "AliYun": 1, } )
Enum value maps for SmsChannel.
var E_Http = annotations.E_Http
var File_jmash_sms_resources_proto protoreflect.FileDescriptor
var File_jmash_sms_service_proto protoreflect.FileDescriptor
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 ¶
RegisterSmsHandler registers the http handlers for service Sms to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterSmsHandlerClient ¶
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 ¶
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 ¶
func (SmsChannel) Type() protoreflect.EnumType
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) SendCaptcha(context.Context, *SendCaptchaReq) (*wrapperspb.BoolValue, error)
func (UnimplementedSmsServer) SendSms ¶
func (UnimplementedSmsServer) SendSms(context.Context, *SendSmsReq) (*wrapperspb.BoolValue, error)
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.