email

package
v0.1.381 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2025 License: Apache-2.0 Imports: 14 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 (
	WelcomeTemplate    contract.TemplateName = "welcome"    // To greet new users.
	SupportTemplate    contract.TemplateName = "support"    // To respond to tickets.
	DeletionTemplate   contract.TemplateName = "deletion"   // To notify users of account deletion.
	ForbiddenTemplate  contract.TemplateName = "forbidden"  // To notify that forbidden content has been deleted.
	WarningTemplate    contract.TemplateName = "warning"    // To warn a user about to be suspended.
	SuspensionTemplate contract.TemplateName = "suspension" // To notify a user that their account has been suspended.
	ConnectionTemplate contract.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.

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

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

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

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

func NewGmailClient added in v0.1.381

func NewGmailClient(ctx context.Context, opts GmailClientOptions) (contract.GmailService, error)

Types

type Blackbox added in v0.1.381

type Blackbox interface {
	contract.EmailByter
	contract.GmailMessager
}

type Client

type Client interface {
	contract.EmailOperator
}

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 contract.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) (contract.SuspensionReason, error)

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 contract.TemplateName, targetLanguage, recipientEmail, recipientUsername string, s contract.Specifics) (*pubsub.Message, error)

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

func (*DefaultTool) SendEmail added in v0.1.381

func (d *DefaultTool) SendEmail(ctx context.Context, opts contract.SendEmailOptions) error

SendEmail sends an email using the provided options.

type Dependencies added in v0.1.8

type GmailClientOptions added in v0.1.381

type GmailClientOptions struct {
	Loaded
}

type Loaded added in v0.1.381

type Loaded struct {
	CredentialsJSON []byte
	Scope           string
	Impersonate     string
}

type Tool added in v0.1.245

type Tool interface {
	Client
}

Jump to

Keyboard shortcuts

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