Documentation
¶
Index ¶
- Constants
- func NewGmailClient(ctx context.Context, opts GmailClientOptions) (contract.GmailService, error)
- type Blackbox
- type Client
- type DefaultTool
- func (d *DefaultTool) EncodeSpecifics(ctx context.Context, s contract.Specifics) (string, error)
- func (d *DefaultTool) GetSuspensionSentence(ctx context.Context, enumVal int) (contract.SuspensionReason, error)
- func (d *DefaultTool) NewPubSubEmail(ctx context.Context, t contract.TemplateName, ...) (*pubsub.Message, error)
- func (d *DefaultTool) SendEmail(ctx context.Context, opts contract.SendEmailOptions) error
- type Dependencies
- type GmailClientOptions
- type Loaded
- type Tool
Constants ¶
const ( PubSubTemplateTypeKey = "templateType" PubSubRecipientUsernameKey = "recipientUsername" PubSubRecipientEmailKey = "recipientEmail" PubSubTargetLanguageKey = "targetLanguage" PubSubSpecificsKey = "specifics" )
Keys for attributes of a Google Pub/Sub message to send an email.
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.
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.
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.
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.
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
func NewTool ¶
func NewTool(c Client, opts contract.ToolOptions[Client]) *DefaultTool
func (*DefaultTool) EncodeSpecifics ¶ added in v0.1.11
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 Dependencies struct {
C contract.GmailClient
M contract.Marshaler
R contract.Reader
W contract.Writer
CL contract.CloserInOut
}
type GmailClientOptions ¶ added in v0.1.381
type GmailClientOptions struct {
Loaded
}