sendgrid

package
v0.12.6 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Host       = "https://api.sendgrid.com"
	ContactsEP = "/v3/marketing/contacts"
	ListsEP    = "/v3/marketing/lists"
	FieldsEP   = "/v3/marketing/field_definitions"
)

Variables

This section is empty.

Functions

func AddContacts added in v0.5.0

func AddContacts(apiKey string, data *AddContactData) (err error)

Add contacts to SendGrid marketing lists.

func FieldDefinitions added in v0.5.0

func FieldDefinitions(apiKey string) (string, error)

Fetch field definitions from SendGrid.

func GetRecipient

func GetRecipient(msg *sgmail.SGMailV3) (recipient string, err error)

func MarketingLists added in v0.5.0

func MarketingLists(apiKey, pageToken string) (string, error)

Fetch lists of contacts from SendGrid.

func WriteMIME

func WriteMIME(msg *sgmail.SGMailV3, path string) (err error)

Types

type AddContactData added in v0.5.0

type AddContactData struct {
	ListIDs  []string   `json:"list_ids"`
	Contacts []*Contact `json:"contacts"`
}

type Contact

type Contact struct {
	FirstName    string        `json:"first_name"`
	LastName     string        `json:"last_name"`
	Email        string        `json:"email"`
	Country      string        `json:"country"`
	CustomFields *CustomFields `json:"custom_fields"`
}

Contact contains contact information for a user, for adding users to marketing lists and sending emails.

func (Contact) FullName

func (c Contact) FullName() string

FullName attempts to construct the contact's full name from existing name fields.

func (Contact) NewEmail

func (c Contact) NewEmail() *mail.Email

NewEmail returns the sendgrid email object for constructing emails.

func (*Contact) ParseName added in v0.5.0

func (c *Contact) ParseName(name string)

ParseName attempts to parse a full name into first and last names on the contact.

type CustomFields

type CustomFields struct {
	Title                string `json:"e1_T"`
	Organization         string `json:"e2_T"`
	CloudServiceProvider string `json:"e3_T"`
}

TODO: make custom fields request to get field IDs rather than hardcoding.

Jump to

Keyboard shortcuts

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