email

package
v0.1.574 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	WelcomeTemplate    contract.EmailTemplateType = "welcome"    // To greet new users.
	SupportTemplate    contract.EmailTemplateType = "support"    // To respond to tickets.
	DeletionTemplate   contract.EmailTemplateType = "deletion"   // To notify users of account deletion.
	ForbiddenTemplate  contract.EmailTemplateType = "forbidden"  // To notify that forbidden content has been deleted.
	WarningTemplate    contract.EmailTemplateType = "warning"    // To warn a user about to be suspended.
	SuspensionTemplate contract.EmailTemplateType = "suspension" // To notify a user that their account has been suspended.
	ConnectionTemplate contract.EmailTemplateType = "connection" // To notify a user that a suspicious connection has been detected.
)
View Source
const (
	// MaxInfringementsReached indicates suspension due to exceeding the maximum number of infringements.
	MaxInfringementsReached contract.EmailSuspensionReason = "Maximum number of infringements reached"
	// IdentityUsurpation indicates suspension due to identity usurpation.
	IdentityUsurpation contract.EmailSuspensionReason = "Identity usurpation"
	// ProfileDetectedFake indicates suspension when a profile is detected as fake.
	ProfileDetectedFake contract.EmailSuspensionReason = "Profile detected to be fake"
	// ProfileDetectedNotHuman indicates suspension when a profile is detected as non-human (e.g., AI, spam, bot).
	ProfileDetectedNotHuman contract.EmailSuspensionReason = "Profile detected to be non-human (e.g., AI, spam, bot)"
)
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.
)
View Source
const (
	TicketsClosureMessage = `` /* 358-byte string literal not displayed */

)

Variables

View Source
var (
	TemplateTypeKey      = contract.ToPubSubKey("template_type")
	RecipientUsernameKey = contract.ToPubSubKey("recipient_username")
	RecipientEmailKey    = contract.ToPubSubKey("recipient_email")
	TargetLanguageKey    = contract.ToPubSubKey("target_language")
	SpecificsKey         = contract.ToPubSubKey("specifics")
)
View Source
var (
	PubSubSpecificsMessageKey      = contract.ToPubSubKey("msg")           // Support template.
	PubSubSpecificsURLKey          = contract.ToPubSubKey("url")           // Support template.
	PubSubSpecificsCountKey        = contract.ToPubSubKey("count")         // Suspension template.
	PubSubSpecificsReasonKey       = contract.ToPubSubKey("reason")        // Suspension template.
	PubSubSpecificsRequestIPKey    = contract.ToPubSubKey("request_ip")    // Connection template.
	PubSubSpecificsUserAgentKey    = contract.ToPubSubKey("user_agent")    // Connection template.
	PubSubSpecificsLocationKey     = contract.ToPubSubKey("location")      // Connection template.
	PubSubSpecificsConnectionIDKey = contract.ToPubSubKey("connection_id") // Connection template.
)

Functions

func NewGmailClient added in v0.1.381

func NewGmailClient(ctx context.Context, retryOpts helper.RetryOptions, opts GmailClientOptions) (*gmail.Service, error)

Types

type Blackbox added in v0.1.381

type Blackbox interface {
	contract.EmailByter
	contract.GmailMessager
}

type Client

type Client interface {
	Blackbox
	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.EmailSpecifics) (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.EmailSuspensionReason, 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.EmailTemplateType, targetLanguage, recipientEmail, recipientUsername string, s contract.EmailSpecifics) (*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 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 {
	contract.EmailOperator
}

Jump to

Keyboard shortcuts

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