Documentation ¶
Index ¶
- Variables
- type APIResponse
- type BlacklistData
- type BroadcastData
- type BroadcastType
- type ChartType
- type Client
- func (c *Client) CreateBroadcast(ctx context.Context, broadcasts []BroadcastData) error
- func (c *Client) CreateEmails(ctx context.Context, emails []EmailData) (int, error)
- func (c *Client) CreateField(ctx context.Context, key string) (*FieldData, error)
- func (c *Client) CreateSubscriber(ctx context.Context, input *SubscriberInput) (*SubscriberData, error)
- func (c *Client) CreateTag(ctx context.Context, tagName string) (*TagData, error)
- func (c *Client) FindSubscriber(ctx context.Context, email string) (*SubscriberData, error)
- func (c *Client) GeoLocateIP(ctx context.Context, ipAddress string) (map[string]interface{}, error)
- func (c *Client) GetBlacklistStatus(ctx context.Context, data *BlacklistData) (map[string]interface{}, error)
- func (c *Client) GetBroadcasts(ctx context.Context) ([]BroadcastData, error)
- func (c *Client) GetContentModeration(ctx context.Context, content string) (map[string]interface{}, error)
- func (c *Client) GetFields(ctx context.Context) ([]FieldData, error)
- func (c *Client) GetGender(ctx context.Context, fullName string) (map[string]interface{}, error)
- func (c *Client) GetReportStats(ctx context.Context, reportID string) (map[string]interface{}, error)
- func (c *Client) GetSegmentStats(ctx context.Context, segmentID string) (map[string]interface{}, error)
- func (c *Client) GetSiteStats(ctx context.Context) (map[string]interface{}, error)
- func (c *Client) GetTags(ctx context.Context) ([]TagData, error)
- func (c *Client) ImportSubscribers(ctx context.Context, subscribers []*SubscriberInput) error
- func (c *Client) SetHTTPClient(client HTTPDoer) error
- func (c *Client) SubscriberCommand(ctx context.Context, commands []CommandData) error
- func (c *Client) TrackEvent(ctx context.Context, events []EventData) error
- func (c *Client) ValidateEmail(ctx context.Context, data *ValidationData) (*ValidationResponse, error)
- type CommandData
- type CommandType
- type Config
- type ContactData
- type EmailData
- type EventData
- type FieldAttributes
- type FieldData
- type FieldsResponse
- type GenderData
- type GeoLocationData
- type HTTPDoer
- type ReportDataPoint
- type ReportResponse
- type SubscriberData
- type SubscriberInput
- type TagData
- type ValidationData
- type ValidationResponse
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidConfig = errors.New("invalid configuration: missing required fields") ErrInvalidEmail = errors.New("invalid email address") ErrInvalidIPAddress = errors.New("invalid IP address") ErrInvalidRequest = errors.New("invalid request parameters") ErrAPIResponse = errors.New("unexpected API response") ErrInvalidName = errors.New("invalid name format") ErrInvalidSegmentID = errors.New("invalid segment ID") ErrInvalidContent = errors.New("invalid content") ErrInvalidTags = errors.New("invalid tags format") ErrInvalidBatchSize = errors.New("invalid batch size") )
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type APIResponse struct { Data struct { ID string `json:"id"` Type string `json:"type"` Attributes json.RawMessage `json:"attributes"` } `json:"data"` }
APIResponse represents the standard API response wrapper
type BlacklistData ¶
type BlacklistData struct { Domain string `json:"domain,omitempty"` IPAddress string `json:"ip,omitempty"` }
BlacklistData represents blacklist check parameters
type BroadcastData ¶
type BroadcastData struct { Name string `json:"name"` Subject string `json:"subject"` Content string `json:"content"` Type BroadcastType `json:"type"` From ContactData `json:"from"` InclusiveTags string `json:"inclusive_tags,omitempty"` ExclusiveTags string `json:"exclusive_tags,omitempty"` SegmentID string `json:"segment_id,omitempty"` BatchSizePerHour int `json:"batch_size_per_hour"` }
BroadcastData represents a broadcast message
type BroadcastType ¶
type BroadcastType string
BroadcastType represents the type of broadcast
const ( BroadcastTypePlain BroadcastType = "plain" BroadcastTypeRaw BroadcastType = "raw" )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main entry point for the Bento SDK
func (*Client) CreateBroadcast ¶
func (c *Client) CreateBroadcast(ctx context.Context, broadcasts []BroadcastData) error
CreateBroadcast creates a new broadcast
func (*Client) CreateEmails ¶
CreateEmails sends one or more emails through Bento
func (*Client) CreateField ¶
CreateField creates a new custom field
func (*Client) CreateSubscriber ¶
func (c *Client) CreateSubscriber(ctx context.Context, input *SubscriberInput) (*SubscriberData, error)
CreateSubscriber creates a new subscriber
func (*Client) FindSubscriber ¶
FindSubscriber retrieves a subscriber by email
func (*Client) GeoLocateIP ¶
GeoLocateIP performs IP geolocation
func (*Client) GetBlacklistStatus ¶
func (c *Client) GetBlacklistStatus(ctx context.Context, data *BlacklistData) (map[string]interface{}, error)
GetBlacklistStatus checks domain or IP address blacklist status
func (*Client) GetBroadcasts ¶
func (c *Client) GetBroadcasts(ctx context.Context) ([]BroadcastData, error)
GetBroadcasts retrieves all broadcasts
func (*Client) GetContentModeration ¶
func (c *Client) GetContentModeration(ctx context.Context, content string) (map[string]interface{}, error)
GetContentModeration performs content moderation
func (*Client) GetReportStats ¶
func (c *Client) GetReportStats(ctx context.Context, reportID string) (map[string]interface{}, error)
GetReportStats retrieves report statistics
func (*Client) GetSegmentStats ¶
func (c *Client) GetSegmentStats(ctx context.Context, segmentID string) (map[string]interface{}, error)
GetSegmentStats retrieves segment statistics
func (*Client) GetSiteStats ¶
GetSiteStats retrieves site statistics
func (*Client) ImportSubscribers ¶
func (c *Client) ImportSubscribers(ctx context.Context, subscribers []*SubscriberInput) error
ImportSubscribers imports multiple subscribers in batch
func (*Client) SetHTTPClient ¶
SetHTTPClient sets a custom HTTP client
func (*Client) SubscriberCommand ¶
func (c *Client) SubscriberCommand(ctx context.Context, commands []CommandData) error
SubscriberCommand executes a command on a subscriber
func (*Client) TrackEvent ¶
TrackEvent sends tracking events to Bento
func (*Client) ValidateEmail ¶
func (c *Client) ValidateEmail(ctx context.Context, data *ValidationData) (*ValidationResponse, error)
ValidateEmail validates an email address
type CommandData ¶
type CommandData struct { Command CommandType `json:"command"` Email string `json:"email"` Query string `json:"query"` }
CommandData represents a subscriber command
type CommandType ¶
type CommandType string
CommandType represents subscriber command types
const ( CommandAddTag CommandType = "add_tag" CommandAddTagViaEvent CommandType = "add_tag_via_event" CommandRemoveTag CommandType = "remove_tag" CommandAddField CommandType = "add_field" CommandRemoveField CommandType = "remove_field" CommandSubscribe CommandType = "subscribe" CommandUnsubscribe CommandType = "unsubscribe" CommandChangeEmail CommandType = "change_email" )
type ContactData ¶
ContactData represents contact information
type EmailData ¶
type EmailData struct { To string `json:"to"` From string `json:"from"` Subject string `json:"subject"` HTMLBody string `json:"html_body"` Transactional bool `json:"transactional"` Personalizations map[string]interface{} `json:"personalizations,omitempty"` }
EmailData represents the structure for creating an email
type EventData ¶
type EventData struct { Type string `json:"type"` Email string `json:"email"` Fields map[string]interface{} `json:"fields,omitempty"` Details map[string]interface{} `json:"details,omitempty"` }
EventData represents a tracking event
type FieldAttributes ¶
type FieldData ¶
type FieldData struct { ID string `json:"id"` Type string `json:"type"` Attributes FieldAttributes `json:"attributes"` }
type FieldsResponse ¶
type FieldsResponse struct {
Data []FieldData `json:"data"`
}
type GenderData ¶
type GenderData struct {
FullName string `json:"name"`
}
GenderData represents gender prediction parameters
type GeoLocationData ¶
type GeoLocationData struct {
IPAddress string `json:"ip"`
}
GeoLocationData represents IP geolocation parameters
type ReportDataPoint ¶
type ReportResponse ¶
type ReportResponse struct { ChartStyle ChartType `json:"chart_style"` Data []ReportDataPoint `json:"data"` ReportName string `json:"report_name"` ReportType string `json:"report_type"` }
type SubscriberData ¶
type SubscriberData struct { ID string `json:"id"` Type string `json:"type"` Attributes struct { UUID string `json:"uuid"` Email string `json:"email"` Fields map[string]interface{} `json:"fields"` CachedTagIDs []string `json:"cached_tag_ids"` UnsubscribedAt *string `json:"unsubscribed_at"` NavigationURL string `json:"navigation_url"` } `json:"attributes"` }
SubscriberData represents subscriber information from the API
type SubscriberInput ¶
type SubscriberInput struct { Email string `json:"email"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` Tags []string `json:"tags,omitempty"` RemoveTags []string `json:"remove_tags,omitempty"` Fields map[string]interface{} `json:"fields,omitempty"` }
SubscriberInput represents the data structure for creating/importing subscribers
type TagData ¶
type TagData struct { ID string `json:"id"` Type string `json:"type"` Attributes struct { Name string `json:"name"` CreatedAt string `json:"created_at"` DiscardedAt *string `json:"discarded_at"` SiteID int `json:"site_id"` } `json:"attributes"` }
TagData represents tag information from the API
type ValidationData ¶
type ValidationData struct { EmailAddress string `json:"email"` FullName string `json:"name,omitempty"` UserAgent string `json:"user_agent,omitempty"` IPAddress string `json:"ip,omitempty"` }
ValidationData represents email validation parameters
type ValidationResponse ¶
type ValidationResponse struct {
Valid bool `json:"valid"`
}