mail

package
v0.0.0-...-707c192 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 15 Imported by: 1

Documentation

Overview

Package mail is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	MailService_Watch_FullMethodName      = "/mail.v1.MailService/Watch"
	MailService_UpdateMail_FullMethodName = "/mail.v1.MailService/UpdateMail"
)
View Source
const (
	MailPrivateService_SendMail_FullMethodName = "/mail.v1.MailPrivateService/SendMail"
)

Variables

View Source
var (
	MailStatus_name = map[int32]string{
		0: "UNREAD",
		1: "READ",
		2: "REWARDED",
		3: "DELETED",
	}
	MailStatus_value = map[string]int32{
		"UNREAD":   0,
		"READ":     1,
		"REWARDED": 2,
		"DELETED":  3,
	}
)

Enum value maps for MailStatus.

View Source
var (
	SendMailRequest_SendType_name = map[int32]string{
		0: "NONE",
		1: "ALL",
		2: "ROLE",
	}
	SendMailRequest_SendType_value = map[string]int32{
		"NONE": 0,
		"ALL":  1,
		"ROLE": 2,
	}
)

Enum value maps for SendMailRequest_SendType.

View Source
var File_mail_mail_proto protoreflect.FileDescriptor
View Source
var MailPrivateService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "mail.v1.MailPrivateService",
	HandlerType: (*MailPrivateServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SendMail",
			Handler:    _MailPrivateService_SendMail_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "mail/mail.proto",
}

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

View Source
var MailService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "mail.v1.MailService",
	HandlerType: (*MailServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "UpdateMail",
			Handler:    _MailService_UpdateMail_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Watch",
			Handler:       _MailService_Watch_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "mail/mail.proto",
}

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

Functions

func RegisterMailPrivateServiceHandler

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

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

func RegisterMailPrivateServiceHandlerClient

func RegisterMailPrivateServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MailPrivateServiceClient) error

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

func RegisterMailPrivateServiceHandlerFromEndpoint

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

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

func RegisterMailPrivateServiceHandlerServer

func RegisterMailPrivateServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MailPrivateServiceServer) error

RegisterMailPrivateServiceHandlerServer registers the http handlers for service MailPrivateService to "mux". UnaryRPC :call MailPrivateServiceServer 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 RegisterMailPrivateServiceHandlerFromEndpoint instead.

func RegisterMailPrivateServiceServer

func RegisterMailPrivateServiceServer(s grpc.ServiceRegistrar, srv MailPrivateServiceServer)

func RegisterMailServiceHandler

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

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

func RegisterMailServiceHandlerClient

func RegisterMailServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MailServiceClient) error

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

func RegisterMailServiceHandlerFromEndpoint

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

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

func RegisterMailServiceHandlerServer

func RegisterMailServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MailServiceServer) error

RegisterMailServiceHandlerServer registers the http handlers for service MailService to "mux". UnaryRPC :call MailServiceServer 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 RegisterMailServiceHandlerFromEndpoint instead.

func RegisterMailServiceServer

func RegisterMailServiceServer(s grpc.ServiceRegistrar, srv MailServiceServer)

Types

type Mail

type Mail struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // mail uid (optional, if not set, will be generated)
	// mail title (required,key: language, value: title)
	// if template_id is set, title will be ignored
	Title map[string]string `` /* 151-byte string literal not displayed */
	// mail content (required key: language, value: content),
	// if template_id is set, content will be ignored
	Body     map[string]string ``                                                                                       /* 149-byte string literal not displayed */
	Date     int64             `protobuf:"varint,4,opt,name=date,proto3" json:"date,omitempty"`                         // mail  send time (optional, if not set, will be now)
	ExpireAt int64             `protobuf:"varint,5,opt,name=expire_at,json=expireAt,proto3" json:"expire_at,omitempty"` // mail expire time (optional, if not set, will be now+90 days)
	// mail sender (required)
	// if template_id is set, sender will be ignored
	From         string        `protobuf:"bytes,6,opt,name=from,proto3" json:"from,omitempty"`
	Rewards      []*MailReward `protobuf:"bytes,7,rep,name=rewards,proto3" json:"rewards,omitempty"`                                //mail rewards (optional)
	Status       MailStatus    `protobuf:"varint,8,opt,name=status,proto3,enum=mail.v1.MailStatus" json:"status,omitempty"`         // mail status (0:unread,1:read,2:rewarded,3:deleted)
	TemplateId   int32         `protobuf:"varint,9,opt,name=template_id,json=templateId,proto3" json:"template_id,omitempty"`       // mail template id (optional)
	TemplateArgs []string      `protobuf:"bytes,10,rep,name=template_args,json=templateArgs,proto3" json:"template_args,omitempty"` // mail template args (optional)
	Filters      *Mail_Filter  `protobuf:"bytes,11,opt,name=filters,proto3" json:"filters,omitempty"`                               // mail filters
	// contains filtered or unexported fields
}

func (*Mail) Descriptor deprecated

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

Deprecated: Use Mail.ProtoReflect.Descriptor instead.

func (*Mail) GetBody

func (x *Mail) GetBody() map[string]string

func (*Mail) GetDate

func (x *Mail) GetDate() int64

func (*Mail) GetExpireAt

func (x *Mail) GetExpireAt() int64

func (*Mail) GetFilters

func (x *Mail) GetFilters() *Mail_Filter

func (*Mail) GetFrom

func (x *Mail) GetFrom() string

func (*Mail) GetId

func (x *Mail) GetId() int64

func (*Mail) GetRewards

func (x *Mail) GetRewards() []*MailReward

func (*Mail) GetStatus

func (x *Mail) GetStatus() MailStatus

func (*Mail) GetTemplateArgs

func (x *Mail) GetTemplateArgs() []string

func (*Mail) GetTemplateId

func (x *Mail) GetTemplateId() int32

func (*Mail) GetTitle

func (x *Mail) GetTitle() map[string]string

func (*Mail) ProtoMessage

func (*Mail) ProtoMessage()

func (*Mail) ProtoReflect

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

func (*Mail) Reset

func (x *Mail) Reset()

func (*Mail) String

func (x *Mail) String() string

type MailPrivateServiceClient

type MailPrivateServiceClient interface {
	// send mail(grpc/http)
	SendMail(ctx context.Context, in *SendMailRequest, opts ...grpc.CallOption) (*SendMailResponse, error)
}

MailPrivateServiceClient is the client API for MailPrivateService 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.

mail service for private (without auth, keep it in internal network)

type MailPrivateServiceServer

type MailPrivateServiceServer interface {
	// send mail(grpc/http)
	SendMail(context.Context, *SendMailRequest) (*SendMailResponse, error)
}

MailPrivateServiceServer is the server API for MailPrivateService service. All implementations should embed UnimplementedMailPrivateServiceServer for forward compatibility

mail service for private (without auth, keep it in internal network)

type MailReward

type MailReward struct {
	Id  int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`   // reward id
	Num int32 `protobuf:"varint,2,opt,name=num,proto3" json:"num,omitempty"` // reward num
	// if expire>0, id must be unique eg.timestamp
	Expire int64 `protobuf:"varint,3,opt,name=expire,proto3" json:"expire,omitempty"` // reward expire time (0 means no expire)
	Type   int32 `protobuf:"varint,4,opt,name=type,proto3" json:"type,omitempty"`     // reward type
	// contains filtered or unexported fields
}

func (*MailReward) Descriptor deprecated

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

Deprecated: Use MailReward.ProtoReflect.Descriptor instead.

func (*MailReward) GetExpire

func (x *MailReward) GetExpire() int64

func (*MailReward) GetId

func (x *MailReward) GetId() int64

func (*MailReward) GetNum

func (x *MailReward) GetNum() int32

func (*MailReward) GetType

func (x *MailReward) GetType() int32

func (*MailReward) ProtoMessage

func (*MailReward) ProtoMessage()

func (*MailReward) ProtoReflect

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

func (*MailReward) Reset

func (x *MailReward) Reset()

func (*MailReward) String

func (x *MailReward) String() string

type MailServiceClient

type MailServiceClient interface {
	// Watch watch mail changes,
	Watch(ctx context.Context, in *WatchMailRequest, opts ...grpc.CallOption) (MailService_WatchClient, error)
	// UpdateMail update mail
	UpdateMail(ctx context.Context, in *UpdateMailRequest, opts ...grpc.CallOption) (*UpdateMailResponse, error)
}

MailServiceClient is the client API for MailService 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.

mail service for pubic

type MailServiceServer

type MailServiceServer interface {
	// Watch watch mail changes,
	Watch(*WatchMailRequest, MailService_WatchServer) error
	// UpdateMail update mail
	UpdateMail(context.Context, *UpdateMailRequest) (*UpdateMailResponse, error)
}

MailServiceServer is the server API for MailService service. All implementations should embed UnimplementedMailServiceServer for forward compatibility

mail service for pubic

type MailService_WatchClient

type MailService_WatchClient interface {
	Recv() (*WatchMailResponse, error)
	grpc.ClientStream
}

type MailService_WatchServer

type MailService_WatchServer interface {
	Send(*WatchMailResponse) error
	grpc.ServerStream
}

type MailStatus

type MailStatus int32
const (
	MailStatus_UNREAD   MailStatus = 0
	MailStatus_READ     MailStatus = 1
	MailStatus_REWARDED MailStatus = 2
	MailStatus_DELETED  MailStatus = 3
)

func (MailStatus) Descriptor

func (MailStatus) Descriptor() protoreflect.EnumDescriptor

func (MailStatus) Enum

func (x MailStatus) Enum() *MailStatus

func (MailStatus) EnumDescriptor deprecated

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

Deprecated: Use MailStatus.Descriptor instead.

func (MailStatus) Number

func (x MailStatus) Number() protoreflect.EnumNumber

func (MailStatus) String

func (x MailStatus) String() string

func (MailStatus) Type

type Mail_Filter

type Mail_Filter struct {

	// role register time (optional, if not set, will be now, if -1 means all register time)
	RegisterTime int64 `protobuf:"varint,1,opt,name=register_time,json=registerTime,proto3" json:"register_time,omitempty"`
	// contains filtered or unexported fields
}

func (*Mail_Filter) Descriptor deprecated

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

Deprecated: Use Mail_Filter.ProtoReflect.Descriptor instead.

func (*Mail_Filter) GetRegisterTime

func (x *Mail_Filter) GetRegisterTime() int64

func (*Mail_Filter) ProtoMessage

func (*Mail_Filter) ProtoMessage()

func (*Mail_Filter) ProtoReflect

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

func (*Mail_Filter) Reset

func (x *Mail_Filter) Reset()

func (*Mail_Filter) String

func (x *Mail_Filter) String() string

type SendMailRequest

type SendMailRequest struct {
	PlatformId string                   `protobuf:"bytes,1,opt,name=platform_id,json=platformId,proto3" json:"platform_id,omitempty"`                                  // platform id (optional, if not set, will be all platforms)
	ChannelId  string                   `protobuf:"bytes,3,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"`                                     // channel id (optional, if not set, will be all channels)
	SendType   SendMailRequest_SendType `protobuf:"varint,4,opt,name=send_type,json=sendType,proto3,enum=mail.v1.SendMailRequest_SendType" json:"send_type,omitempty"` // send type (0:none,1:all,2:role)
	RoleIds    []string                 `protobuf:"bytes,5,rep,name=role_ids,json=roleIds,proto3" json:"role_ids,omitempty"`                                           // role id (optional, if not set, will be all roles)
	Mail       *Mail                    `protobuf:"bytes,6,opt,name=mail,proto3" json:"mail,omitempty"`                                                                // mail content
	// contains filtered or unexported fields
}

send mail(private)

func (*SendMailRequest) Descriptor deprecated

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

Deprecated: Use SendMailRequest.ProtoReflect.Descriptor instead.

func (*SendMailRequest) GetChannelId

func (x *SendMailRequest) GetChannelId() string

func (*SendMailRequest) GetMail

func (x *SendMailRequest) GetMail() *Mail

func (*SendMailRequest) GetPlatformId

func (x *SendMailRequest) GetPlatformId() string

func (*SendMailRequest) GetRoleIds

func (x *SendMailRequest) GetRoleIds() []string

func (*SendMailRequest) GetSendType

func (x *SendMailRequest) GetSendType() SendMailRequest_SendType

func (*SendMailRequest) ProtoMessage

func (*SendMailRequest) ProtoMessage()

func (*SendMailRequest) ProtoReflect

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

func (*SendMailRequest) Reset

func (x *SendMailRequest) Reset()

func (*SendMailRequest) String

func (x *SendMailRequest) String() string

type SendMailRequest_SendType

type SendMailRequest_SendType int32
const (
	SendMailRequest_NONE SendMailRequest_SendType = 0
	SendMailRequest_ALL  SendMailRequest_SendType = 1
	SendMailRequest_ROLE SendMailRequest_SendType = 2
)

func (SendMailRequest_SendType) Descriptor

func (SendMailRequest_SendType) Enum

func (SendMailRequest_SendType) EnumDescriptor deprecated

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

Deprecated: Use SendMailRequest_SendType.Descriptor instead.

func (SendMailRequest_SendType) Number

func (SendMailRequest_SendType) String

func (x SendMailRequest_SendType) String() string

func (SendMailRequest_SendType) Type

type SendMailResponse

type SendMailResponse struct {
	// contains filtered or unexported fields
}

send mail response

func (*SendMailResponse) Descriptor deprecated

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

Deprecated: Use SendMailResponse.ProtoReflect.Descriptor instead.

func (*SendMailResponse) ProtoMessage

func (*SendMailResponse) ProtoMessage()

func (*SendMailResponse) ProtoReflect

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

func (*SendMailResponse) Reset

func (x *SendMailResponse) Reset()

func (*SendMailResponse) String

func (x *SendMailResponse) String() string

type UnimplementedMailPrivateServiceServer

type UnimplementedMailPrivateServiceServer struct {
}

UnimplementedMailPrivateServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedMailPrivateServiceServer) SendMail

type UnimplementedMailServiceServer

type UnimplementedMailServiceServer struct {
}

UnimplementedMailServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedMailServiceServer) UpdateMail

func (UnimplementedMailServiceServer) Watch

type UnsafeMailPrivateServiceServer

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

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

type UnsafeMailServiceServer

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

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

type UpdateMailRequest

type UpdateMailRequest struct {
	Updates map[int64]MailStatus `` //  <mailId,mailStatus> mailId=0 means update all mails
	/* 181-byte string literal not displayed */
	// contains filtered or unexported fields
}

update mail status

func (*UpdateMailRequest) Descriptor deprecated

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

Deprecated: Use UpdateMailRequest.ProtoReflect.Descriptor instead.

func (*UpdateMailRequest) GetUpdates

func (x *UpdateMailRequest) GetUpdates() map[int64]MailStatus

func (*UpdateMailRequest) ProtoMessage

func (*UpdateMailRequest) ProtoMessage()

func (*UpdateMailRequest) ProtoReflect

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

func (*UpdateMailRequest) Reset

func (x *UpdateMailRequest) Reset()

func (*UpdateMailRequest) String

func (x *UpdateMailRequest) String() string

type UpdateMailResponse

type UpdateMailResponse struct {
	Rewards map[int64]*MailReward `` // if update mail status to REWARDED, rewards will be returned
	/* 156-byte string literal not displayed */
	// contains filtered or unexported fields
}

update mail status response

func (*UpdateMailResponse) Descriptor deprecated

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

Deprecated: Use UpdateMailResponse.ProtoReflect.Descriptor instead.

func (*UpdateMailResponse) GetRewards

func (x *UpdateMailResponse) GetRewards() map[int64]*MailReward

func (*UpdateMailResponse) ProtoMessage

func (*UpdateMailResponse) ProtoMessage()

func (*UpdateMailResponse) ProtoReflect

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

func (*UpdateMailResponse) Reset

func (x *UpdateMailResponse) Reset()

func (*UpdateMailResponse) String

func (x *UpdateMailResponse) String() string

type WatchMailRequest

type WatchMailRequest struct {
	Channel      string `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"`                                // channel
	Language     string `protobuf:"bytes,2,opt,name=language,proto3" json:"language,omitempty"`                              // language
	RegisterTime int64  `protobuf:"varint,3,opt,name=register_time,json=registerTime,proto3" json:"register_time,omitempty"` // register time
	// contains filtered or unexported fields
}

watch mail changes request

func (*WatchMailRequest) Descriptor deprecated

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

Deprecated: Use WatchMailRequest.ProtoReflect.Descriptor instead.

func (*WatchMailRequest) GetChannel

func (x *WatchMailRequest) GetChannel() string

func (*WatchMailRequest) GetLanguage

func (x *WatchMailRequest) GetLanguage() string

func (*WatchMailRequest) GetRegisterTime

func (x *WatchMailRequest) GetRegisterTime() int64

func (*WatchMailRequest) ProtoMessage

func (*WatchMailRequest) ProtoMessage()

func (*WatchMailRequest) ProtoReflect

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

func (*WatchMailRequest) Reset

func (x *WatchMailRequest) Reset()

func (*WatchMailRequest) String

func (x *WatchMailRequest) String() string

type WatchMailResponse

type WatchMailResponse struct {
	Mails map[int64]*Mail `` // mail changes
	/* 152-byte string literal not displayed */
	// contains filtered or unexported fields
}

watch mail changes response

func (*WatchMailResponse) Descriptor deprecated

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

Deprecated: Use WatchMailResponse.ProtoReflect.Descriptor instead.

func (*WatchMailResponse) GetMails

func (x *WatchMailResponse) GetMails() map[int64]*Mail

func (*WatchMailResponse) ProtoMessage

func (*WatchMailResponse) ProtoMessage()

func (*WatchMailResponse) ProtoReflect

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

func (*WatchMailResponse) Reset

func (x *WatchMailResponse) Reset()

func (*WatchMailResponse) String

func (x *WatchMailResponse) String() string

Jump to

Keyboard shortcuts

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