handler

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ImageFileSizeLimit = 2097000

ImageFileSizeLimit limits file sizes to be converted to 2MB(Mebibytes) in Bytes

View Source
const VideoFileSizeLimit = 1024000

VideoFileSizeLimit limits video to be much smaller cuz over 1000KiB(1MiB) seems not to animate

View Source
const WebPFormat = ".webp"

WebPFormat is the extension of webp

Variables

This section is empty.

Functions

func Run

func Run(event *whatsapp.WhatsappIncomingMessage, ch *amqp.Channel, convertQueue *amqp.Queue, loggingQueue *amqp.Queue)

Run : the appropriate handler using the event type

Types

type Handler

type Handler interface {
	// Setup the handler, event and context to reply
	SetUp(event *whatsapp.Message, phoneNumberID string)
	// Validate : ensures the media conforms to some standards
	// also sends message to client about issue
	Validate() error
	// Handle : obtains the message to be sent as response
	Handle(ch *amqp.Channel, pushTo *amqp.Queue) error
}

Handler interface for multiple message types

type Media

type Media struct {
	RawPath       string
	ConvertedPath string
	MetadataPath  string
	Message       *whatsapp.Message
	PhoneNumberID string
	MediaURL      string
	Len           int
	MediaType     string
}

func (*Media) Handle

func (handler *Media) Handle(ch *amqp.Channel, pushTo *amqp.Queue) error

func (*Media) SetUp

func (handler *Media) SetUp(message *whatsapp.Message, phoneNumberID string)

func (*Media) Validate

func (handler *Media) Validate() error

Jump to

Keyboard shortcuts

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