Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) DeleteSubscriber(idOrEmail string) (*Response, error)
- func (c *Client) FetchSubscriber(idOrEmail string) (*SubscribersResp, error)
- func (c *Client) ListSubscribers(req *ListSubscribersReq) (*SubscribersResp, error)
- func (c *Client) RemoveSubscriberTag(req *TagReq) (*Response, error)
- func (c *Client) TagSubscriber(req *TagsReq) (*Response, error)
- func (c *Client) UpdateBatchSubscribers(req *UpdateBatchSubscribersReq) (*SubscribersResp, error)
- func (c *Client) UpdateSubscriber(req *UpdateSubscribersReq) (*SubscribersResp, error)
- type Code
- type CodeError
- type Links
- type ListSubscribersReq
- type Meta
- type Response
- type Subscriber
- type SubscribersBatch
- type SubscribersResp
- type TagReq
- type TagsReq
- type UpdateBatchSubscribersReq
- type UpdateSubscriber
- type UpdateSubscribersReq
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBadAPIKey is returned by New if bad api key. ErrBadAPIKey = fmt.Errorf("bad api key") // ErrBadAccountID is returned by New if bad account ID. ErrBadAccountID = fmt.Errorf("bad drip account id") // ErrIDorEmailEmpty is returned if id and email are both empty. ErrIDorEmailEmpty = fmt.Errorf("ID and Email both cannot be empty") // ErrInvalidInput is returned if input is invalid. ErrInvalidInput = fmt.Errorf("invalid input") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { HTTPClient *http.Client UserAgent string // contains filtered or unexported fields }
Client is a client to interact with the Drip API. Use https://www.getdrip.com/docs/rest-api for extra documentation.
func (*Client) DeleteSubscriber ¶
DeleteSubscriber deletes a subscriber.
func (*Client) FetchSubscriber ¶
func (c *Client) FetchSubscriber(idOrEmail string) (*SubscribersResp, error)
FetchSubscriber fetches a subscriber.
func (*Client) ListSubscribers ¶
func (c *Client) ListSubscribers(req *ListSubscribersReq) (*SubscribersResp, error)
ListSubscribers returns a list of subscribers. Either an ID or Email can
func (*Client) RemoveSubscriberTag ¶
RemoveSubscriberTag adds a tag to a subscriber.
func (*Client) TagSubscriber ¶
TagSubscriber adds a tag to a subscriber.
func (*Client) UpdateBatchSubscribers ¶
func (c *Client) UpdateBatchSubscribers(req *UpdateBatchSubscribersReq) (*SubscribersResp, error)
UpdateBatchSubscribers creates or updates a subscribers. We recommend using this API endpoint when you need to create or update a collection of subscribers at once. Note: Since our batch APIs process requests in the background, there may be a delay between the time you submit your request and the time your data appears in user interface.
func (*Client) UpdateSubscriber ¶
func (c *Client) UpdateSubscriber(req *UpdateSubscribersReq) (*SubscribersResp, error)
UpdateSubscriber creates or updates a subscriber. If you need to create or update a collection of subscribers at once, use our batch API instead.
type Code ¶
type Code string
Code is an Code returned with errors from the Drip API. https://www.getdrip.com/docs/rest-api#errors
const ( // PresenceError means the attribute is required. PresenceError Code = "presence_error" // LengthError means the length of the attribute is out of bounds. LengthError Code = "length_error" // UniquenessError means the attribute must be unique. UniquenessError Code = "uniqueness_error" // EmailError means the attribute must be a valid email address. EmailError Code = "email_error" // URLError means the attribute must be a valid URL. URLError Code = "url_error" // DomainError means the attribute must be a valid domain name. DomainError Code = "domain_error" // TimeError means the attribute must be a valid time in ISO-8601 format. TimeError Code = "time_error" // EmailAddressListError means the attribute must be a valid comma-separated list of email addresses. EmailAddressListError Code = "email_address_list_error" // DaysOfTheWeekError means the attribute must be a valid days of the week mask of the format /\A(0|1){7}\z/ (excluding 0000000). DaysOfTheWeekError Code = "days_of_the_week_error" UnavailableError Code = "unavailable_error" // FormatError means a resource identifier or object is not formatted correctly. FormatError Code = "format_error" // RangeError means a numeric value is out of range. RangeError Code = "range_error" )
type CodeError ¶
type CodeError struct { Code string `json:"code"` Attribute string `json:"attribute"` Message string `json:"message"` }
CodeError is a error with a code. https://www.getdrip.com/docs/rest-api#errors
type Links ¶
type Links struct { Account string `json:"account,omitempty"` Forms []string `json:"forms,omitempty"` Subscriber string `json:"subscriber,omitempty"` }
Links are links send in responses.
type ListSubscribersReq ¶
type ListSubscribersReq struct { Status string `url:"status,omitempty"` Tags []string `url:"tags,omitempty"` SubscribedBefore *time.Time `url:"subscribed_before,omitempty"` SubscribedAfter *time.Time `url:"subscribed_after,omitempty"` Page *int `url:"page,omitempty"` PerPage *int `url:"per_page,omitempty"` }
ListSubscribersReq is a request for ListSubscribers.
type Meta ¶
type Meta struct { Page int `json:"page,omitempty"` Count int `json:"count,omitempty"` TotalPages int `json:"total_pages,omitempty"` TotalCount int `json:"total_count,omitempty"` }
Meta is data related to pagination. https://www.getdrip.com/docs/rest-api#pagination
type Response ¶
type Response struct { StatusCode int `json:"status_code,omitempty"` Errors []CodeError `json:"errors,omitempty"` }
Response is a basic response recieved.
type Subscriber ¶
type Subscriber struct { ID string `json:"id,omitempty"` Status string `json:"status,omitempty"` Email string `json:"email,omitempty"` TimeZone string `json:"time_zone,omitempty"` UTCOffset int `json:"utc_offset,omitempty"` VisitorUUID string `json:"visitor_uuid,omitempty"` CustomFields map[string]string `json:"custom_fields,omitempty"` Tags []string `json:"tags,omitempty"` IPAddress string `json:"ip_address,omitempty"` UserAgent string `json:"user_agent,omitempty"` OriginalReferrer string `json:"original_referrer,omitempty"` LandingURL string `json:"landing_url,omitempty"` Prospect bool `json:"prospect,omitempty"` LeadScore int `json:"lead_score,omitempty"` LifetimeValue int `json:"lifetime_value,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` HREF string `json:"href,omitempty"` UserID string `json:"user_id,omitempty"` BaseLeadScore int `json:"base_lead_score,omitempty"` Links Links `json:"links,omitempty"` }
Subscriber is a subscriber.
type SubscribersBatch ¶
type SubscribersBatch struct {
Subscribers []UpdateSubscriber `json:"subscribers,omitempty"`
}
SubscribersBatch is a request for UpdateBatchSubscribers.
type SubscribersResp ¶
type SubscribersResp struct { StatusCode int `json:"status_code,omniempty"` Links Links `json:"links,omitempty"` Meta Meta `json:"meta,omitempty"` Subscribers []*Subscriber `json:"subscribers,omitempty"` Errors []CodeError `json:"errors,omitempty"` }
SubscribersResp is a response recieved with subscribers in it. List functions have Meta for pagination. StatusCode is included in resp.
type TagsReq ¶
type TagsReq struct {
Tags []TagReq `json:"tags,omitempty"`
}
TagsReq is a request for TagSubscription.
type UpdateBatchSubscribersReq ¶
type UpdateBatchSubscribersReq struct {
Batches []SubscribersBatch `json:"batches,omitempty"`
}
UpdateBatchSubscribersReq is a request for UpdateBatchSubscribers.
type UpdateSubscriber ¶
type UpdateSubscriber struct { Email string `json:"email,omitempty"` ID string `json:"id,omitempty"` NewEmail string `json:"new_email,omitempty"` UserID string `json:"user_id,omitempty"` TimeZone string `json:"time_zone,omitempty"` LifetimeValue *float32 `json:"lifetime_value,omitempty"` IPAddress string `json:"ip_address,omitempty"` CustomFields map[string]string `json:"custom_fields,omitempty"` Tags []string `json:"tags,omitempty"` RemoveTags []string `json:"remove_tags,omitempty"` Prospect *bool `json:"prospect,omitempty"` BaseLeadScore *int `json:"base_lead_score,omitempty"` }
UpdateSubscriber is the info available to update or create a subscriber.
type UpdateSubscribersReq ¶
type UpdateSubscribersReq struct {
Subscribers []UpdateSubscriber `json:"subscribers,omitempty"`
}
UpdateSubscribersReq is a request for UpdateSubscriber.