Documentation
¶
Index ¶
- Constants
- Variables
- func NewGmailClient(ctx context.Context, retryOpts helper.RetryOptions, 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, opts contract.NewPubSubEmailOptions) (*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 ( // 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(contract.NewPath("template", "type")) RecipientUsernameKey = contract.ToPubSubKey(contract.NewPath("recipient", "username")) RecipientEmailKey = contract.ToPubSubKey(contract.NewPath("recipient", "email")) RecipientIDKey = contract.ToPubSubKey(contract.NewPath("recipient", "id")) TargetLanguageKey = contract.ToPubSubKey(contract.NewPath("target", "language")) SpecificsKey = contract.ToPubSubKey(contract.NewPath("specifics")) )
View Source
var ( PubSubSpecificsMessageKey = contract.ToPubSubKey(contract.NewPath("msg")) // Support template. PubSubSpecificsURLKey = contract.ToPubSubKey(contract.NewPath("url")) // Support template. PubSubSpecificsCountKey = contract.ToPubSubKey(contract.NewPath("count")) // Suspension template. PubSubSpecificsReasonKey = contract.ToPubSubKey(contract.NewPath("reason")) // Suspension template. PubSubSpecificsRequestIPKey = contract.ToPubSubKey(contract.NewPath("request", "ip")) // Connection template. PubSubSpecificsUserAgentKey = contract.ToPubSubKey(contract.NewPath("user", "agent")) // Connection template. PubSubSpecificsLocationKey = contract.ToPubSubKey(contract.NewPath("location")) // Connection template. PubSubSpecificsConnectionIDKey = contract.ToPubSubKey(contract.NewPath("connection", "id")) // Connection template. PubSubSpecificsLowCreditsRemainingKey = contract.ToPubSubKey(contract.NewPath("low", "credits", "remaining")) // Low credits template. PubSubSpecificsPaidEntityNumberKey = contract.ToPubSubKey(contract.NewPath("paid", "entity", "number")) PubSubSpecificsPaidEntityTypeKey = contract.ToPubSubKey(contract.NewPath("paid", "entity", "type")) PubSubSpecificsPaidAmountKey = contract.ToPubSubKey(contract.NewPath("paid", "amount")) PubSubSpecificsPaidCurrencyKey = contract.ToPubSubKey(contract.NewPath("paid", "currency")) PubSubSpecificsPaidDateKey = contract.ToPubSubKey(contract.NewPath("paid", "date")) PubSubSpecificsExternalPayerNameKey = contract.ToPubSubKey(contract.NewPath("external", "payer", "name")) PubSubSpecificsExternalPayerEmailKey = contract.ToPubSubKey(contract.NewPath("external", "payer", "email")) PubSubSpecificsInternalPayerUsernameKey = contract.ToPubSubKey(contract.NewPath("internal", "payer", "username")) PubSubSpecificsFeeAmountKey = contract.ToPubSubKey(contract.NewPath("fee", "amount")) PubSubSpecificsFeeTaxAmountKey = contract.ToPubSubKey(contract.NewPath("fee", "tax", "amount")) PubSubSpecificsFeeTotalAmountKey = contract.ToPubSubKey(contract.NewPath("fee", "total", "amount")) PubSubSpecificsCompanyCodeKey = contract.ToPubSubKey(contract.NewPath("company", "code")) PubSubSpecificsDueAmountKey = contract.ToPubSubKey(contract.NewPath("due", "amount")) PubSubSpecificsDownloadURLKey = contract.ToPubSubKey(contract.NewPath("download", "url")) PubSubSpecificsPayURLKey = contract.ToPubSubKey(contract.NewPath("pay", "url")) )
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)
func NewNoopClient ¶ added in v0.1.859
func NewNoopClient() Client
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, opts contract.NewPubSubEmailOptions) (*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
PS contract.PubSubOperator
}
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.