sms

package
v0.12.6 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 18 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 (
	SmsProvider_name = map[int32]string{
		0: "ONFON",
	}
	SmsProvider_value = map[string]int32{
		"ONFON": 0,
	}
)

Enum value maps for SmsProvider.

Functions

func RegisterSMSAPIHandler

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

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

func RegisterSMSAPIHandlerClient

func RegisterSMSAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SMSAPIClient) error

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

func RegisterSMSAPIHandlerFromEndpoint

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

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

func RegisterSMSAPIHandlerServer

func RegisterSMSAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SMSAPIServer) error

RegisterSMSAPIHandlerServer registers the http handlers for service SMSAPI to "mux". UnaryRPC :call SMSAPIServer 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 RegisterSMSAPIHandlerFromEndpoint instead.

func RegisterSMSAPIServer

func RegisterSMSAPIServer(s grpc.ServiceRegistrar, srv SMSAPIServer)

Types

type Cookie struct {
	Name  string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Cookie) Descriptor deprecated

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

Deprecated: Use Cookie.ProtoReflect.Descriptor instead.

func (*Cookie) GetName

func (x *Cookie) GetName() string

func (*Cookie) GetValue

func (x *Cookie) GetValue() string

func (*Cookie) ProtoMessage

func (*Cookie) ProtoMessage()

func (*Cookie) ProtoReflect

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

func (*Cookie) Reset

func (x *Cookie) Reset()

func (*Cookie) String

func (x *Cookie) String() string

type CreateSenderCredentialsRequest

type CreateSenderCredentialsRequest struct {
	Credential *SenderCredential `protobuf:"bytes,1,opt,name=credential,proto3" json:"credential,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateSenderCredentialsRequest) Descriptor deprecated

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

Deprecated: Use CreateSenderCredentialsRequest.ProtoReflect.Descriptor instead.

func (*CreateSenderCredentialsRequest) GetCredential

func (*CreateSenderCredentialsRequest) ProtoMessage

func (*CreateSenderCredentialsRequest) ProtoMessage()

func (*CreateSenderCredentialsRequest) ProtoReflect

func (*CreateSenderCredentialsRequest) Reset

func (x *CreateSenderCredentialsRequest) Reset()

func (*CreateSenderCredentialsRequest) String

type GetSenderCredentialRequest

type GetSenderCredentialRequest struct {
	CredentialId string `protobuf:"bytes,1,opt,name=credential_id,json=credentialId,proto3" json:"credential_id,omitempty"`
	UseProjectId bool   `protobuf:"varint,2,opt,name=use_project_id,json=useProjectId,proto3" json:"use_project_id,omitempty"`
	// contains filtered or unexported fields
}

func (*GetSenderCredentialRequest) Descriptor deprecated

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

Deprecated: Use GetSenderCredentialRequest.ProtoReflect.Descriptor instead.

func (*GetSenderCredentialRequest) GetCredentialId

func (x *GetSenderCredentialRequest) GetCredentialId() string

func (*GetSenderCredentialRequest) GetUseProjectId

func (x *GetSenderCredentialRequest) GetUseProjectId() bool

func (*GetSenderCredentialRequest) ProtoMessage

func (*GetSenderCredentialRequest) ProtoMessage()

func (*GetSenderCredentialRequest) ProtoReflect

func (*GetSenderCredentialRequest) Reset

func (x *GetSenderCredentialRequest) Reset()

func (*GetSenderCredentialRequest) String

func (x *GetSenderCredentialRequest) String() string

type SMS

type SMS struct {
	DestinationPhones []string `protobuf:"bytes,2,rep,name=destination_phones,json=destinationPhones,proto3" json:"destination_phones,omitempty"`
	Keyword           string   `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"`
	Message           string   `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*SMS) Descriptor deprecated

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

Deprecated: Use SMS.ProtoReflect.Descriptor instead.

func (*SMS) GetDestinationPhones

func (x *SMS) GetDestinationPhones() []string

func (*SMS) GetKeyword

func (x *SMS) GetKeyword() string

func (*SMS) GetMessage

func (x *SMS) GetMessage() string

func (*SMS) ProtoMessage

func (*SMS) ProtoMessage()

func (*SMS) ProtoReflect

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

func (*SMS) Reset

func (x *SMS) Reset()

func (*SMS) String

func (x *SMS) String() string

type SMSAPIClient

type SMSAPIClient interface {
	// Send an sms to its destination(s)
	SendSMS(ctx context.Context, in *SendSMSRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Create a sender id credential
	CreateSenderCredential(ctx context.Context, in *CreateSenderCredentialsRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Get a sender id credential
	GetSenderCredential(ctx context.Context, in *GetSenderCredentialRequest, opts ...grpc.CallOption) (*SenderCredential, error)
}

SMSAPIClient is the client API for SMSAPI 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 NewSMSAPIClient

func NewSMSAPIClient(cc grpc.ClientConnInterface) SMSAPIClient

type SMSAPIServer

type SMSAPIServer interface {
	// Send an sms to its destination(s)
	SendSMS(context.Context, *SendSMSRequest) (*empty.Empty, error)
	// Create a sender id credential
	CreateSenderCredential(context.Context, *CreateSenderCredentialsRequest) (*empty.Empty, error)
	// Get a sender id credential
	GetSenderCredential(context.Context, *GetSenderCredentialRequest) (*SenderCredential, error)
	// contains filtered or unexported methods
}

SMSAPIServer is the server API for SMSAPI service. All implementations must embed UnimplementedSMSAPIServer for forward compatibility

type SMSAuth

type SMSAuth struct {

	// [sms_url, sender_id, api_key, client_id, auth_token, access_key, cookies]
	ApiUrl    string    `protobuf:"bytes,1,opt,name=api_url,json=apiUrl,proto3" json:"api_url,omitempty"`
	SenderId  string    `protobuf:"bytes,2,opt,name=sender_id,json=senderId,proto3" json:"sender_id,omitempty"`
	ApiKey    string    `protobuf:"bytes,3,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"`
	ClientId  string    `protobuf:"bytes,4,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
	AuthToken string    `protobuf:"bytes,5,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"`
	AccessKey string    `protobuf:"bytes,6,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"`
	Cookies   []*Cookie `protobuf:"bytes,7,rep,name=cookies,proto3" json:"cookies,omitempty"`
	AppName   string    `protobuf:"bytes,8,opt,name=app_name,json=appName,proto3" json:"app_name,omitempty"`
	// contains filtered or unexported fields
}

func (*SMSAuth) Descriptor deprecated

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

Deprecated: Use SMSAuth.ProtoReflect.Descriptor instead.

func (*SMSAuth) GetAccessKey

func (x *SMSAuth) GetAccessKey() string

func (*SMSAuth) GetApiKey

func (x *SMSAuth) GetApiKey() string

func (*SMSAuth) GetApiUrl

func (x *SMSAuth) GetApiUrl() string

func (*SMSAuth) GetAppName

func (x *SMSAuth) GetAppName() string

func (*SMSAuth) GetAuthToken

func (x *SMSAuth) GetAuthToken() string

func (*SMSAuth) GetClientId

func (x *SMSAuth) GetClientId() string

func (*SMSAuth) GetCookies

func (x *SMSAuth) GetCookies() []*Cookie

func (*SMSAuth) GetSenderId

func (x *SMSAuth) GetSenderId() string

func (*SMSAuth) ProtoMessage

func (*SMSAuth) ProtoMessage()

func (*SMSAuth) ProtoReflect

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

func (*SMSAuth) Reset

func (x *SMSAuth) Reset()

func (*SMSAuth) String

func (x *SMSAuth) String() string

type SendSMSRequest

type SendSMSRequest struct {
	Sms         *SMS        `protobuf:"bytes,1,opt,name=sms,proto3" json:"sms,omitempty"`
	Auth        *SMSAuth    `protobuf:"bytes,2,opt,name=auth,proto3" json:"auth,omitempty"`
	Provider    SmsProvider `protobuf:"varint,3,opt,name=provider,proto3,enum=gidyon.apis.SmsProvider" json:"provider,omitempty"`
	ProjectId   string      `protobuf:"bytes,4,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`
	FetchSender bool        `protobuf:"varint,5,opt,name=fetch_sender,json=fetchSender,proto3" json:"fetch_sender,omitempty"`
	// contains filtered or unexported fields
}

func (*SendSMSRequest) Descriptor deprecated

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

Deprecated: Use SendSMSRequest.ProtoReflect.Descriptor instead.

func (*SendSMSRequest) GetAuth

func (x *SendSMSRequest) GetAuth() *SMSAuth

func (*SendSMSRequest) GetFetchSender

func (x *SendSMSRequest) GetFetchSender() bool

func (*SendSMSRequest) GetProjectId

func (x *SendSMSRequest) GetProjectId() string

func (*SendSMSRequest) GetProvider

func (x *SendSMSRequest) GetProvider() SmsProvider

func (*SendSMSRequest) GetSms

func (x *SendSMSRequest) GetSms() *SMS

func (*SendSMSRequest) ProtoMessage

func (*SendSMSRequest) ProtoMessage()

func (*SendSMSRequest) ProtoReflect

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

func (*SendSMSRequest) Reset

func (x *SendSMSRequest) Reset()

func (*SendSMSRequest) String

func (x *SendSMSRequest) String() string

type SenderCredential

type SenderCredential struct {
	CredentialId string   `protobuf:"bytes,1,opt,name=credential_id,json=credentialId,proto3" json:"credential_id,omitempty"`
	ProjectId    string   `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`
	Auth         *SMSAuth `protobuf:"bytes,3,opt,name=auth,proto3" json:"auth,omitempty"`
	// contains filtered or unexported fields
}

func (*SenderCredential) Descriptor deprecated

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

Deprecated: Use SenderCredential.ProtoReflect.Descriptor instead.

func (*SenderCredential) GetAuth

func (x *SenderCredential) GetAuth() *SMSAuth

func (*SenderCredential) GetCredentialId

func (x *SenderCredential) GetCredentialId() string

func (*SenderCredential) GetProjectId

func (x *SenderCredential) GetProjectId() string

func (*SenderCredential) ProtoMessage

func (*SenderCredential) ProtoMessage()

func (*SenderCredential) ProtoReflect

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

func (*SenderCredential) Reset

func (x *SenderCredential) Reset()

func (*SenderCredential) String

func (x *SenderCredential) String() string

type SmsProvider

type SmsProvider int32
const (
	SmsProvider_ONFON SmsProvider = 0
)

func (SmsProvider) Descriptor

func (SmsProvider) Enum

func (x SmsProvider) Enum() *SmsProvider

func (SmsProvider) EnumDescriptor deprecated

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

Deprecated: Use SmsProvider.Descriptor instead.

func (SmsProvider) Number

func (x SmsProvider) Number() protoreflect.EnumNumber

func (SmsProvider) String

func (x SmsProvider) String() string

func (SmsProvider) Type

type UnimplementedSMSAPIServer

type UnimplementedSMSAPIServer struct {
}

UnimplementedSMSAPIServer must be embedded to have forward compatible implementations.

func (UnimplementedSMSAPIServer) CreateSenderCredential

func (UnimplementedSMSAPIServer) GetSenderCredential

func (UnimplementedSMSAPIServer) SendSMS

type UnsafeSMSAPIServer

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

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

Jump to

Keyboard shortcuts

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