core

package
v0.0.0-...-6acd299 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: MIT Imports: 11 Imported by: 4

Documentation

Index

Constants

View Source
const (
	EnvKeyBotName            = "BOT_NAME"
	EnvKeyChannelSecret      = "CHANNEL_SECRET"
	EnvKeyChannelAccessToken = "CHANNEL_ACCESS_TOKEN"
	EnvKeyMid                = "MID"
)

environment variable key

Variables

This section is empty.

Functions

func ChildFunctions

func ChildFunctions(ctx context.Context, message *pubsub.Message, op *Operation) error

ChildFunctions - CloudFunctions(Trigger: Pub/Sub)

func ParentFunctions

func ParentFunctions(ctx context.Context, message *pubsub.Message, topic *pubsub.Topic) error

ParentFunctions - CloudFunctions(Trigger: Pub/Sub)

func WebHook

func WebHook(ctx *gin.Context, secret string, topic *pubsub.Topic)

WebHook - CloudFunctions(Trigger: HTTP)

Types

type Operation

type Operation struct {
	ErrMessage []linebot.SendingMessage
	*Tracer
	*linebot.Client
}

Operation - structure to be managed collectively

func (*Operation) NewRouter

func (op *Operation) NewRouter(ctx context.Context, engine *gin.Engine) error

NewRouter - Routing

func (*Operation) SendPushMessage

func (op *Operation) SendPushMessage(uid string, messages []linebot.SendingMessage) error

SendPushMessage - send PushMessage

func (*Operation) SendReplyMessage

func (op *Operation) SendReplyMessage(token string, messages []linebot.SendingMessage) error

SendReplyMessage - send ReplyMessage

func (*Operation) Switcher

func (op *Operation) Switcher(ctx context.Context, event *linebot.Event) (err error)

Switcher - separate processing for each event

type Tracer

type Tracer struct {
	Function map[TracerName]func(ctx context.Context, op *Operation, event *linebot.Event) *TracerResp
	LiffFunc map[string]func(ctx *gin.Context)
}

Tracer - hold processing function for each event

func (*Tracer) Execute

func (tracer *Tracer) Execute(ctx context.Context, engine *gin.Engine) error

Execute - create and run instance

type TracerName

type TracerName = string

TracerName - Events Name

const (
	TracerTextMessage     TracerName = "TextMessage"
	TracerImageMessage    TracerName = "ImageMessage"
	TracerVideoMessage    TracerName = "VideoMessage"
	TracerAudioMessage    TracerName = "AudioMessage"
	TracerFileMessage     TracerName = "FileMessage"
	TracerLocationMessage TracerName = "LocationMessage"
	TracerStickerMessage  TracerName = "StickerMessage"

	TracerFollowEvent       TracerName = "follow"
	TracerUnfollowEvent     TracerName = "unfollow"
	TracerJoinEvent         TracerName = "join"
	TracerLeaveEvent        TracerName = "leave"
	TracerMemberJoinedEvent TracerName = "memberJoined"
	TracerMemberLeftEvent   TracerName = "memberLeft"
	TracerPostBackEvent     TracerName = "postback"
	TracerBeaconEvent       TracerName = "beacon"
	TracerAccountLinkEvent  TracerName = "accountLink"
	TracerThingsEvent       TracerName = "things"
)

event Name

type TracerResp

type TracerResp struct {
	Stack []linebot.SendingMessage
	Error error
}

TracerResp - hold items for outgoing messages

Jump to

Keyboard shortcuts

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