emailjuice

package
v1.17.9 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Description: This package provides a set of functions to send emails using Fabriktor's email templates. It follows the Google Cloud Pub/Sub message format to send emails asynchronously.

Index

Constants

View Source
const (
	NA = iota
	MaxInfringementsReachedReason
	IdentityUsurpationReason
	ProfileDetectedFakeReason
	ProfileDetectedNotHumanReason
)

To allow to easily pass and retrieve suspension reason from query parameters.

View Source
const (
	TicketsClosureMessage = `` /* 361-byte string literal not displayed */

)

Support related constants.

Variables

This section is empty.

Functions

func EncodeSpecifics added in v1.15.5

func EncodeSpecifics(specifics Specifics) (string, error)

EncodeSpecifics encodes a map of specifics to a JSON string.

func NewPubSubEmail added in v1.15.2

func NewPubSubEmail(templateType TemplateName, targetLanguage, recipientEmail, recipientUsername Key, specifics Specifics) (*pubsub.Message, error)

NewPubSubEmail mimicks the reception of a PubSub email message for testing and previewing purposes.

Do not use this function in production code.

Types

type Key added in v1.15.2

type Key string
const (
	PubSubTemplateTypeKey      Key = "templateType"
	PubSubRecipientUsernameKey Key = "recipientUsername"
	PubSubRecipientEmailKey    Key = "recipientEmail"
	PubSubTargetLanguageKey    Key = "targetLanguage"
	PubSubSpecificsKey         Key = "specifics"
)

Keys represent the key of the attributes of a Google Pub/Sub message to send an email.

type Specifics added in v1.15.6

type Specifics map[SpecificsKey]string

func (Specifics) MarshalJSON added in v1.15.6

func (s Specifics) MarshalJSON() ([]byte, error)

Implementation of json.Marshaler interface for Specifics type.

type SpecificsKey added in v1.15.1

type SpecificsKey string
const (
	PubSubSpecificsMessageKey SpecificsKey = "msg"
	PubSubSpecificsURLKey     SpecificsKey = "url"

	PubSubSpecificsCountKey SpecificsKey = "count"

	PubSubSpecificsReasonKey SpecificsKey = "reason"
)

Pub/Sub related constants to be used in the `specifics` attribute of a Google Pub/Sub message.

type SuspensionReason

type SuspensionReason string
const (
	// MaxInfringementsReached represents the reason for suspension when the maximum number of infringements is reached.
	MaxInfringementsReached SuspensionReason = "Maximum number of infringements reached"

	// IdentityUsurpation represents the reason for suspension due to identity usurpation.
	IdentityUsurpation SuspensionReason = "Identity usurpation"

	// ProfileDetectedFake represents the reason for suspension when a profile is detected to be fake.
	ProfileDetectedFake SuspensionReason = "Profile detected to be fake"

	// ProfileDetectedNotHuman represents the reason for suspension when a profile is detected to be non-human, potentially AI, spam, bot, etc.
	ProfileDetectedNotHuman SuspensionReason = "Profile detected to be not human, maybe AI, spam, bot, etc."
)

Specifics represent predefined values for the `reason` subfield of `specifics` attribute of a Google Pub/Sub message.

func GetSuspensionSentence added in v1.17.7

func GetSuspensionSentence(enumValue int) SuspensionReason

GetSuspensionSentence returns the suspension reason as a string.

type TemplateName

type TemplateName string
const (
	WelcomeTemplate    TemplateName = "welcome"
	SupportTemplate    TemplateName = "support"
	DeletionTemplate   TemplateName = "deletion"
	ForbiddenTemplate  TemplateName = "forbidden"
	WarningTemplate    TemplateName = "warning"
	SuspensionTemplate TemplateName = "suspension"
)

TemplateName represent the name of Fabriktor's email templates. To be assigned to the `templateType` attribute of a Google Pub/Sub message.

Jump to

Keyboard shortcuts

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