email

package
v0.1.128 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2025 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PubSubTemplateTypeKey      = "templateType"
	PubSubRecipientUsernameKey = "recipientUsername"
	PubSubRecipientEmailKey    = "recipientEmail"
	PubSubTargetLanguageKey    = "targetLanguage"
	PubSubSpecificsKey         = "specifics"
)

Keys for attributes of a Google Pub/Sub message to send an email.

View Source
const (
	NA                            = iota // No reason specified.
	MaxInfringementsReachedReason        // Maximum number of infringements reached.
	IdentityUsurpationReason             // Identity usurpation.
	ProfileDetectedFakeReason            // Profile detected as fake.
	ProfileDetectedNotHumanReason        // Profile detected as non-human.
)

Enum values to pass and retrieve suspension reasons from query parameters.

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

)

Support-related constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	NewPubSubEmail(t TemplateName, targetLanguage, recipientEmail, recipientUsername string, s Specifics) (*pubsub.Message, error)
	EncodeSpecifics(s Specifics) (string, error)
	GetSuspensionSentence(enumVal int) SuspensionReason
}

func NewClient

func NewClient(d Dependencies) (Client, error)

type DefaultTool added in v0.1.11

type DefaultTool struct {
	T *contract.Tool[Client]
}

func NewTool

func NewTool(c Client, opts contract.ToolOptions[Client]) *DefaultTool

func (*DefaultTool) EncodeSpecifics added in v0.1.11

func (d *DefaultTool) EncodeSpecifics(ctx context.Context, s Specifics) (string, error)

EncodeSpecifics encodes specifics to a JSON string.

func (*DefaultTool) GetSuspensionSentence added in v0.1.11

func (d *DefaultTool) GetSuspensionSentence(ctx context.Context, enumVal int) SuspensionReason

GetSuspensionSentence retrieves the suspension reason based on an enum value.

func (*DefaultTool) NewPubSubEmail added in v0.1.11

func (d *DefaultTool) NewPubSubEmail(ctx context.Context, t TemplateName, targetLanguage, recipientEmail, recipientUsername string, s Specifics) (*pubsub.Message, error)

NewPubSubEmail creates a mock Pub/Sub email message for testing.

type Dependencies added in v0.1.8

type Dependencies struct {
	M contract.Marshaler
}

type Specifics

type Specifics map[SpecificsKey]string

Specifics holds key-value pairs for email-specific attributes.

type SpecificsKey

type SpecificsKey string

SpecificsKey is a key in the specifics map for email attributes.

const (
	// For SupportTemplate.
	PubSubSpecificsMessageKey SpecificsKey = "msg"
	PubSubSpecificsURLKey     SpecificsKey = "url"
	// For SuspensionTemplate.
	PubSubSpecificsCountKey  SpecificsKey = "count"
	PubSubSpecificsReasonKey SpecificsKey = "reason"
	// For ConnectionTemplate.
	PubSubSpecificsRequestIPKey    SpecificsKey = "request_ip"
	PubSubSpecificsUserAgentKey    SpecificsKey = "user_agent"
	PubSubSpecificsLocationKey     SpecificsKey = "location"
	PubSubSpecificsConnectionIDKey SpecificsKey = "connection_id"
)

Pub/Sub-related constants for the specifics attribute of a Google Pub/Sub message.

type SuspensionReason

type SuspensionReason string

SuspensionReason is a reason for account suspension.

const (
	// MaxInfringementsReached indicates suspension due to exceeding the maximum number of infringements.
	MaxInfringementsReached SuspensionReason = "Maximum number of infringements reached"
	// IdentityUsurpation indicates suspension due to identity usurpation.
	IdentityUsurpation SuspensionReason = "Identity usurpation"
	// ProfileDetectedFake indicates suspension when a profile is detected as fake.
	ProfileDetectedFake SuspensionReason = "Profile detected to be fake"
	// ProfileDetectedNotHuman indicates suspension when a profile is detected as non-human (e.g., AI, spam, bot).
	ProfileDetectedNotHuman SuspensionReason = "Profile detected to be non-human (e.g., AI, spam, bot)"
)

SuspensionReason constants represent predefined values for the reason field in the specifics attribute of a Google Pub/Sub message.

type TemplateName

type TemplateName string

TemplateName is the name of an email template.

const (
	WelcomeTemplate    TemplateName = "welcome"    // To greet new users.
	SupportTemplate    TemplateName = "support"    // To respond to tickets.
	DeletionTemplate   TemplateName = "deletion"   // To notify users of account deletion.
	ForbiddenTemplate  TemplateName = "forbidden"  // To notify that forbidden content has been deleted.
	WarningTemplate    TemplateName = "warning"    // To warn a user about to be suspended.
	SuspensionTemplate TemplateName = "suspension" // To notify a user that their account has been suspended.
	ConnectionTemplate TemplateName = "connection" // To notify a user that a suspicious connection has been detected.
)

TemplateName constants represent Fabriktor's email template names. These are 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