lime

package
v0.0.0-...-3a81907 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIServer

type APIServer interface {
	Start() error
}

func NewServer

func NewServer(env Env, ops ...APIServerOption) APIServer

type APIServerOption

type APIServerOption func(s *apiOptions)

func WithEventHandler

func WithEventHandler(handler EventHandler) APIServerOption

func WithHealthz

func WithHealthz(fn http.HandlerFunc) APIServerOption

func WithLogger

func WithLogger(logger *zap.Logger) APIServerOption

func WithReadiness

func WithReadiness(fn http.HandlerFunc) APIServerOption

type Env

type Env struct {
	Port       string `envconfig:"port" default:"8080"`
	HandlePath string `envconfig:"handle_path" default:"/callback"`

	ReadTimeoutSec  int `envconfig:"read_timeout_sec" default:"5"`
	WriteTimeoutSec int `envconfig:"write_timeout_sec" default:"10"`
	IdleTimeoutSec  int `envconfig:"idle_timeout_sec" default:"120"`
	EventTimeoutSec int `envconfig:"event_timeout_sec" default:"15"`

	ChannelSecret string `envconfig:"channel_secret" default:"mock-secret"`

	// EnableReturnErrorCode is a flag to enable re-delivery webhook.
	//   If True, returns a code other than 200 when an error occurs in EventHandler.
	//   If Webhook resend is enabled in LINE Messaging API, the same event will be resent.
	//   Please implement the following in event handlers.
	//
	//  - Do not re-execute events with WebhookEventIDs that have already been processed.
	//  - Or, the processing in the handler should idempotent.
	EnableReturnErrorCode bool `envconfig:"enable_re_delivery_webhook" default:"false"`
	// EnableEventLog is a flag to enable per-event access logging..
	//   To output on the event handler side, set to false.
	EnableEventLog bool `envconfig:"enable_event_log" default:"true"`
}

func (Env) EventTimeout

func (c Env) EventTimeout() time.Duration

func (Env) IdleTimeout

func (c Env) IdleTimeout() time.Duration

func (Env) ReadTimeout

func (c Env) ReadTimeout() time.Duration

func (Env) WriteTimeout

func (c Env) WriteTimeout() time.Duration

type EventHandler

type EventHandler interface {
	EventType() linebot.EventType
	Handle(ctx context.Context, event *linebot.Event) error
}

type OptionType

type OptionType string

Jump to

Keyboard shortcuts

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