notificationv1

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotificationService_SendNotification_FullMethodName = "/notification.v1.NotificationService/SendNotification"
)

Variables

View Source
var (
	Channel_name = map[int32]string{
		0: "CHANNEL_UNSPECIFIED",
		1: "FEISHU_CARD",
		2: "EMAIL",
		3: "IN_APP",
	}
	Channel_value = map[string]int32{
		"CHANNEL_UNSPECIFIED": 0,
		"FEISHU_CARD":         1,
		"EMAIL":               2,
		"IN_APP":              3,
	}
)

Enum value maps for Channel.

View Source
var (
	SendStatus_name = map[int32]string{
		0: "SEND_STATUS_UNSPECIFIED",
		1: "PREPARE",
		2: "CANCELED",
		3: "PENDING",
		4: "SUCCEEDED",
		5: "FAILED",
	}
	SendStatus_value = map[string]int32{
		"SEND_STATUS_UNSPECIFIED": 0,
		"PREPARE":                 1,
		"CANCELED":                2,
		"PENDING":                 3,
		"SUCCEEDED":               4,
		"FAILED":                  5,
	}
)

Enum value maps for SendStatus.

View Source
var (
	ErrorCode_name = map[int32]string{
		0:  "ERROR_CODE_UNSPECIFIED",
		1:  "INVALID_PARAMETER",
		2:  "RATE_LIMITED",
		3:  "TEMPLATE_NOT_FOUND",
		4:  "CHANNEL_DISABLED",
		5:  "CREATE_NOTIFICATION_FAILED",
		6:  "BIZ_ID_NOT_FOUND",
		7:  "NOTIFICATION_NOT_FOUND",
		8:  "NO_AVAILABLE_PROVIDER",
		9:  "NO_AVAILABLE_CHANNEL",
		10: "SEND_NOTIFICATION_FAILED",
		11: "CONFIG_NOT_FOUND",
		12: "NO_QUOTA_CONFIG",
		13: "NO_QUOTA",
		14: "QUOTA_NOT_FOUND",
		15: "PROVIDER_NOT_FOUND",
		16: "UNKNOWN_CHANNEL",
	}
	ErrorCode_value = map[string]int32{
		"ERROR_CODE_UNSPECIFIED":     0,
		"INVALID_PARAMETER":          1,
		"RATE_LIMITED":               2,
		"TEMPLATE_NOT_FOUND":         3,
		"CHANNEL_DISABLED":           4,
		"CREATE_NOTIFICATION_FAILED": 5,
		"BIZ_ID_NOT_FOUND":           6,
		"NOTIFICATION_NOT_FOUND":     7,
		"NO_AVAILABLE_PROVIDER":      8,
		"NO_AVAILABLE_CHANNEL":       9,
		"SEND_NOTIFICATION_FAILED":   10,
		"CONFIG_NOT_FOUND":           11,
		"NO_QUOTA_CONFIG":            12,
		"NO_QUOTA":                   13,
		"QUOTA_NOT_FOUND":            14,
		"PROVIDER_NOT_FOUND":         15,
		"UNKNOWN_CHANNEL":            16,
	}
)

Enum value maps for ErrorCode.

View Source
var File_notification_v1_notification_proto protoreflect.FileDescriptor
View Source
var NotificationService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "notification.v1.NotificationService",
	HandlerType: (*NotificationServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SendNotification",
			Handler:    _NotificationService_SendNotification_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "notification/v1/notification.proto",
}

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

Functions

func RegisterNotificationServiceServer

func RegisterNotificationServiceServer(s grpc.ServiceRegistrar, srv NotificationServiceServer)

Types

type BatchSendNotificationsRequest

type BatchSendNotificationsRequest struct {
	Notifications []*Notification `protobuf:"bytes,1,rep,name=notifications,proto3" json:"notifications,omitempty"`
	// contains filtered or unexported fields
}

同步批量发送通知请求

func (*BatchSendNotificationsRequest) Descriptor deprecated

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

Deprecated: Use BatchSendNotificationsRequest.ProtoReflect.Descriptor instead.

func (*BatchSendNotificationsRequest) GetNotifications

func (x *BatchSendNotificationsRequest) GetNotifications() []*Notification

func (*BatchSendNotificationsRequest) ProtoMessage

func (*BatchSendNotificationsRequest) ProtoMessage()

func (*BatchSendNotificationsRequest) ProtoReflect

func (*BatchSendNotificationsRequest) Reset

func (x *BatchSendNotificationsRequest) Reset()

func (*BatchSendNotificationsRequest) String

type BatchSendNotificationsResponse

type BatchSendNotificationsResponse struct {

	// 所有结果
	Results []*SendNotificationResponse `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
	// 总数
	TotalCount int32 `protobuf:"varint,2,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"`
	// 成功数
	SuccessCount int32 `protobuf:"varint,3,opt,name=success_count,json=successCount,proto3" json:"success_count,omitempty"`
	// contains filtered or unexported fields
}

同步批量发送通知响应

func (*BatchSendNotificationsResponse) Descriptor deprecated

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

Deprecated: Use BatchSendNotificationsResponse.ProtoReflect.Descriptor instead.

func (*BatchSendNotificationsResponse) GetResults

func (*BatchSendNotificationsResponse) GetSuccessCount

func (x *BatchSendNotificationsResponse) GetSuccessCount() int32

func (*BatchSendNotificationsResponse) GetTotalCount

func (x *BatchSendNotificationsResponse) GetTotalCount() int32

func (*BatchSendNotificationsResponse) ProtoMessage

func (*BatchSendNotificationsResponse) ProtoMessage()

func (*BatchSendNotificationsResponse) ProtoReflect

func (*BatchSendNotificationsResponse) Reset

func (x *BatchSendNotificationsResponse) Reset()

func (*BatchSendNotificationsResponse) String

type Channel

type Channel int32

渠道类型枚举

const (
	// 未指定渠道
	Channel_CHANNEL_UNSPECIFIED Channel = 0
	// 短信
	Channel_FEISHU_CARD Channel = 1
	// 邮件
	Channel_EMAIL Channel = 2
	// 站内信
	Channel_IN_APP Channel = 3
)

func (Channel) Descriptor

func (Channel) Descriptor() protoreflect.EnumDescriptor

func (Channel) Enum

func (x Channel) Enum() *Channel

func (Channel) EnumDescriptor deprecated

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

Deprecated: Use Channel.Descriptor instead.

func (Channel) Number

func (x Channel) Number() protoreflect.EnumNumber

func (Channel) String

func (x Channel) String() string

func (Channel) Type

func (Channel) Type() protoreflect.EnumType

type ErrorCode

type ErrorCode int32

错误代码枚举

const (
	// 未指定错误码
	ErrorCode_ERROR_CODE_UNSPECIFIED ErrorCode = 0
	// 无效参数
	ErrorCode_INVALID_PARAMETER ErrorCode = 1
	// 频率限制
	ErrorCode_RATE_LIMITED ErrorCode = 2
	// 模板未找到
	ErrorCode_TEMPLATE_NOT_FOUND ErrorCode = 3
	// 渠道被禁用
	ErrorCode_CHANNEL_DISABLED ErrorCode = 4
	// 创建通知失败
	ErrorCode_CREATE_NOTIFICATION_FAILED ErrorCode = 5
	// 业务ID未找到
	ErrorCode_BIZ_ID_NOT_FOUND ErrorCode = 6
	// 通知未找到
	ErrorCode_NOTIFICATION_NOT_FOUND ErrorCode = 7
	// 无可用供应商
	ErrorCode_NO_AVAILABLE_PROVIDER ErrorCode = 8
	// 无可用渠道
	ErrorCode_NO_AVAILABLE_CHANNEL ErrorCode = 9
	// 发送通知失败
	ErrorCode_SEND_NOTIFICATION_FAILED ErrorCode = 10
	// 业务配置不存在
	ErrorCode_CONFIG_NOT_FOUND ErrorCode = 11
	// 没有提供配额相关配置
	ErrorCode_NO_QUOTA_CONFIG ErrorCode = 12
	// 额度已用完
	ErrorCode_NO_QUOTA ErrorCode = 13
	// 额度记录不存在
	ErrorCode_QUOTA_NOT_FOUND ErrorCode = 14
	// 供应商记录不存在
	ErrorCode_PROVIDER_NOT_FOUND ErrorCode = 15
	// 未知渠道类型
	ErrorCode_UNKNOWN_CHANNEL ErrorCode = 16
)

func (ErrorCode) Descriptor

func (ErrorCode) Descriptor() protoreflect.EnumDescriptor

func (ErrorCode) Enum

func (x ErrorCode) Enum() *ErrorCode

func (ErrorCode) EnumDescriptor deprecated

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

Deprecated: Use ErrorCode.Descriptor instead.

func (ErrorCode) Number

func (x ErrorCode) Number() protoreflect.EnumNumber

func (ErrorCode) String

func (x ErrorCode) String() string

func (ErrorCode) Type

type Notification

type Notification struct {

	// 业务方某个业务内部的唯一标识
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// 接收者标识(可以是用户ID、邮箱、手机号等)
	Receivers []string `protobuf:"bytes,2,rep,name=receivers,proto3" json:"receivers,omitempty"`
	// 发送渠道
	Channel Channel `protobuf:"varint,3,opt,name=channel,proto3,enum=notification.v1.Channel" json:"channel,omitempty"`
	// 模板ID
	TemplateId int64 `protobuf:"varint,4,opt,name=template_id,json=templateId,proto3" json:"template_id,omitempty"`
	// 模板参数
	TemplateParams *structpb.Struct `protobuf:"bytes,5,opt,name=template_params,json=templateParams,proto3" json:"template_params,omitempty"`
	// 通知人
	Receiver string `protobuf:"bytes,6,opt,name=receiver,proto3" json:"receiver,omitempty"`
	// contains filtered or unexported fields
}

通知

func (*Notification) Descriptor deprecated

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

Deprecated: Use Notification.ProtoReflect.Descriptor instead.

func (*Notification) GetChannel

func (x *Notification) GetChannel() Channel

func (*Notification) GetKey

func (x *Notification) GetKey() string

func (*Notification) GetReceiver

func (x *Notification) GetReceiver() string

func (*Notification) GetReceivers

func (x *Notification) GetReceivers() []string

func (*Notification) GetTemplateId

func (x *Notification) GetTemplateId() int64

func (*Notification) GetTemplateParams

func (x *Notification) GetTemplateParams() *structpb.Struct

func (*Notification) ProtoMessage

func (*Notification) ProtoMessage()

func (*Notification) ProtoReflect

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

func (*Notification) Reset

func (x *Notification) Reset()

func (*Notification) String

func (x *Notification) String() string

type NotificationServiceClient

type NotificationServiceClient interface {
	// 同步单条发送
	SendNotification(ctx context.Context, in *SendNotificationRequest, opts ...grpc.CallOption) (*SendNotificationResponse, error)
}

NotificationServiceClient is the client API for NotificationService 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.

type NotificationServiceServer

type NotificationServiceServer interface {
	// 同步单条发送
	SendNotification(context.Context, *SendNotificationRequest) (*SendNotificationResponse, error)
	// contains filtered or unexported methods
}

NotificationServiceServer is the server API for NotificationService service. All implementations must embed UnimplementedNotificationServiceServer for forward compatibility.

type SendNotificationRequest

type SendNotificationRequest struct {
	Notification *Notification `protobuf:"bytes,1,opt,name=notification,proto3" json:"notification,omitempty"`
	// contains filtered or unexported fields
}

同步单条发送通知请求

func (*SendNotificationRequest) Descriptor deprecated

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

Deprecated: Use SendNotificationRequest.ProtoReflect.Descriptor instead.

func (*SendNotificationRequest) GetNotification

func (x *SendNotificationRequest) GetNotification() *Notification

func (*SendNotificationRequest) ProtoMessage

func (*SendNotificationRequest) ProtoMessage()

func (*SendNotificationRequest) ProtoReflect

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

func (*SendNotificationRequest) Reset

func (x *SendNotificationRequest) Reset()

func (*SendNotificationRequest) String

func (x *SendNotificationRequest) String() string

type SendNotificationResponse

type SendNotificationResponse struct {

	// 通知平台生成的通知ID
	NotificationId uint64 `protobuf:"varint,1,opt,name=notification_id,json=notificationId,proto3" json:"notification_id,omitempty"`
	// 发送状态
	Status SendStatus `protobuf:"varint,2,opt,name=status,proto3,enum=notification.v1.SendStatus" json:"status,omitempty"`
	// 失败时的错误代码
	ErrorCode ErrorCode `protobuf:"varint,3,opt,name=error_code,json=errorCode,proto3,enum=notification.v1.ErrorCode" json:"error_code,omitempty"`
	// 错误详情
	ErrorMessage string `protobuf:"bytes,4,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"`
	// contains filtered or unexported fields
}

同步单条发送通知响应

func (*SendNotificationResponse) Descriptor deprecated

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

Deprecated: Use SendNotificationResponse.ProtoReflect.Descriptor instead.

func (*SendNotificationResponse) GetErrorCode

func (x *SendNotificationResponse) GetErrorCode() ErrorCode

func (*SendNotificationResponse) GetErrorMessage

func (x *SendNotificationResponse) GetErrorMessage() string

func (*SendNotificationResponse) GetNotificationId

func (x *SendNotificationResponse) GetNotificationId() uint64

func (*SendNotificationResponse) GetStatus

func (x *SendNotificationResponse) GetStatus() SendStatus

func (*SendNotificationResponse) ProtoMessage

func (*SendNotificationResponse) ProtoMessage()

func (*SendNotificationResponse) ProtoReflect

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

func (*SendNotificationResponse) Reset

func (x *SendNotificationResponse) Reset()

func (*SendNotificationResponse) String

func (x *SendNotificationResponse) String() string

type SendStatus

type SendStatus int32

通知发送状态枚举

const (
	// 未指定通知发送状态
	SendStatus_SEND_STATUS_UNSPECIFIED SendStatus = 0
	// 事务消息,准备阶段
	SendStatus_PREPARE SendStatus = 1
	// 事务消息,取消发送
	SendStatus_CANCELED SendStatus = 2
	// 等待发送,普通消息的默认状态,事务消息的确认发送状态(二者重合故用一个状态表示)
	SendStatus_PENDING SendStatus = 3
	// 发送成功
	SendStatus_SUCCEEDED SendStatus = 4
	// 发送失败
	SendStatus_FAILED SendStatus = 5
)

func (SendStatus) Descriptor

func (SendStatus) Descriptor() protoreflect.EnumDescriptor

func (SendStatus) Enum

func (x SendStatus) Enum() *SendStatus

func (SendStatus) EnumDescriptor deprecated

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

Deprecated: Use SendStatus.Descriptor instead.

func (SendStatus) Number

func (x SendStatus) Number() protoreflect.EnumNumber

func (SendStatus) String

func (x SendStatus) String() string

func (SendStatus) Type

type UnimplementedNotificationServiceServer

type UnimplementedNotificationServiceServer struct{}

UnimplementedNotificationServiceServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedNotificationServiceServer) SendNotification

type UnsafeNotificationServiceServer

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

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

Jump to

Keyboard shortcuts

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