Documentation
¶
Index ¶
- Constants
- Variables
- func NewGmailClient(ctx context.Context, opts GmailClientOptions) (*gmail.Service, error)
- type Blackbox
- type Client
- type DefaultTool
- func (d *DefaultTool) EncodeSpecifics(ctx context.Context, s contract.EmailSpecifics) (string, error)
- func (d *DefaultTool) GetSuspensionSentence(ctx context.Context, enumVal int) (contract.EmailSuspensionReason, error)
- func (d *DefaultTool) NewPubSubEmail(ctx context.Context, t contract.EmailTemplateType, ...) (*pubsub.Message, error)
- func (d *DefaultTool) SendEmail(ctx context.Context, opts contract.SendEmailOptions) error
- type Dependencies
- type GmailClientOptions
- type Loaded
- type Tool
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
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
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 Dependencies ¶ added in v0.1.8
type Dependencies struct {
C contract.GmailService
CU contract.GmailUsersMessageService
M contract.Marshaler
R contract.Reader
W contract.Writer
CL contract.CloserInOut
}
type GmailClientOptions ¶ added in v0.1.381
type GmailClientOptions struct {
Loaded
}
type Tool ¶ added in v0.1.245
type Tool interface {
contract.EmailOperator
}
Click to show internal directories.
Click to hide internal directories.