qrapp

package module
v0.0.0-...-0d9bd5b Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mailer

type Mailer interface {
	// SendReply sends a reply email.
	SendReply(ctx context.Context, messageID, from, to, subject, text, html string) error
}

type Message

type Message struct {
	NotificationType string `json:"notificationType"`
	Mail             struct {
		CommonHeaders struct {
			ReturnPath string   `json:"returnPath"`
			From       []string `json:"from"`
			MessageID  string   `json:"messageId"`
			Subject    string   `json:"subject"`
		} `json:"commonHeaders"`
	} `json:"mail"`
	Receipt struct {
		Recipients []string `json:"recipients"`
		Action     struct {
			Type       string `json:"type"`
			BucketName string `json:"bucketName"`
			ObjectKey  string `json:"objectKey"`
		} `json:"action"`
	} `json:"receipt"`
}

type ProcessingResult

type ProcessingResult struct {
	AttachmentName string
	AttachmentURL  string
	QRImageURL     string
	Error          error
}

type QRApp

type QRApp struct {
	Storage        Storage
	Mailer         Mailer
	FilesBucket    string
	FilesBucketURL string
}

func (*QRApp) ProcessEmail

func (q *QRApp) ProcessEmail(ctx context.Context, msg *Message) error

type S3Storage

type S3Storage struct {
	S3Downloader *manager.Downloader
	S3Uploader   *manager.Uploader
	S3Client     *s3.Client
}

func (*S3Storage) Delete

func (ss *S3Storage) Delete(ctx context.Context, bucket, key string) error

func (*S3Storage) DownloadToTmpFile

func (ss *S3Storage) DownloadToTmpFile(ctx context.Context, bucket, key string) (fs.File, error)

func (*S3Storage) RemoveTmpFile

func (ss *S3Storage) RemoveTmpFile(ctx context.Context, tmpFile fs.File) error

func (*S3Storage) Upload

func (ss *S3Storage) Upload(ctx context.Context, bucket, key, contentType string, r io.Reader) error

type SESMailer

type SESMailer struct {
	SESClient *ses.Client
}

func (*SESMailer) SendReply

func (sm *SESMailer) SendReply(ctx context.Context, messageID, from, to, subject, text, html string) error

type Storage

type Storage interface {
	// DownloadToTmpFile downloads an object from a bucket to a temporary file.
	DownloadToTmpFile(ctx context.Context, bucket, key string) (fs.File, error)

	// RemoveTmpFile removes a temporary file created by DownloadToTmpFile.
	RemoveTmpFile(ctx context.Context, tmpFile fs.File) error

	// Upload uploads an object to a bucket, using the contents from the reader, setting the given content type.
	Upload(ctx context.Context, bucket, key, contentType string, r io.Reader) error

	// Delete deletes an object from a bucket.
	Delete(ctx context.Context, bucket, key string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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