Documentation
¶
Index ¶
- func CheckResponse(r *http.Response) error
- type AddTagToContactRequest
- type AddTagToContactResponse
- type Client
- type ClientOpts
- type Contact
- type ContactList
- type ContactTag
- type ContactsService
- func (s *ContactsService) AddTagToContact(contact *AddTagToContactRequest) (*AddTagToContactResponse, *Response, error)
- func (s *ContactsService) Create(contact *CreateContactRequest) (*CreateContactResponse, *Response, error)
- func (s *ContactsService) CreateCustomFieldValue(fieldValue *CreateCustomFieldValueRequest) (*CreateCustomFieldValueResponse, *Response, error)
- func (s *ContactsService) UpdateListStatusForContact(contact *UpdateListStatusForContactRequest) (*UpdateContactListStatusResponse, *Response, error)
- type CreateContactRequest
- type CreateContactResponse
- type CreateCustomFieldValueRequest
- type CreateCustomFieldValueResponse
- type CreateTagRequest
- type CreatedContact
- type CreatedTag
- type FieldValue
- type Links
- type ListAllResponse
- type Meta
- type Response
- type Tag
- type TagResponse
- type TagsService
- type UpdateContactListStatusResponse
- type UpdateListStatusForContactRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. The caller is responsible to analyze the response body.
Types ¶
type AddTagToContactRequest ¶
type AddTagToContactRequest struct {
ContactTag *ContactTag `json:"contactTag"`
}
AddTagToContactRequest is the request body used for adding a tag to a contact.
type AddTagToContactResponse ¶
type AddTagToContactResponse struct {
ContactTag *ContactTag `json:"contactTag"`
}
AddTagToContactResponse is the response body from adding a tag to a contact.
type Client ¶
type Client struct {
// Services used for talking to different parts of the Active Campaign API.
Contacts *ContactsService
Tags *TagsService
// contains filtered or unexported fields
}
A Client manages communication with the Active Campaign API.
func NewClient ¶
func NewClient(opts *ClientOpts) (*Client, error)
NewClient returns a new Active Campaign API client. httpClient is provided to allow a custom client in specialized cases. If a nil httpClient is provided, a new http.DefaultClient will be used.
type ClientOpts ¶
ClientOpts are used to build a new client. If desired, a custom httpClient can be passed in.
type ContactList ¶
type ContactTag ¶
type ContactTag struct {
CDate string `json:"cdate,omitempty"`
Contact string `json:"contact"`
ID string `json:"id,omitempty"`
Links *struct {
Contact string `json:"contact,omitempty"`
Tag string `json:"tag,omitempty"`
} `json:"links,omitempty"`
Tag string `json:"tag"`
}
ContactTag is used to add a tag to a contact.
type ContactsService ¶
type ContactsService service
ContactsService handles communication with contact related methods of the Active Campaign API.
Active Campaign API docs: https://developers.activecampaign.com/reference#contact
func (*ContactsService) AddTagToContact ¶
func (s *ContactsService) AddTagToContact(contact *AddTagToContactRequest) (*AddTagToContactResponse, *Response, error)
AddTagToContact adds a tag to a contact.
func (*ContactsService) Create ¶
func (s *ContactsService) Create(contact *CreateContactRequest) (*CreateContactResponse, *Response, error)
func (*ContactsService) CreateCustomFieldValue ¶
func (s *ContactsService) CreateCustomFieldValue(fieldValue *CreateCustomFieldValueRequest) (*CreateCustomFieldValueResponse, *Response, error)
CreateCustomFieldValue adds a custom field to a contact.
func (*ContactsService) UpdateListStatusForContact ¶
func (s *ContactsService) UpdateListStatusForContact(contact *UpdateListStatusForContactRequest) (*UpdateContactListStatusResponse, *Response, error)
type CreateContactRequest ¶
type CreateContactRequest struct {
Contact *Contact `json:"contact"`
}
type CreateContactResponse ¶
type CreateContactResponse struct {
Contact *CreatedContact `json:"contact"`
}
type CreateCustomFieldValueRequest ¶
type CreateCustomFieldValueRequest struct {
FieldValue *FieldValue `json:"fieldValue"`
}
CreateCustomFieldValueRequest is the request body used for updating a custom field value on a contact.
type CreateCustomFieldValueResponse ¶
type CreateCustomFieldValueResponse struct {
Contacts []struct {
Cdate string `json:"cdate"`
Email string `json:"email"`
Phone string `json:"phone"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Orgid string `json:"orgid"`
Orgname string `json:"orgname"`
SegmentioID string `json:"segmentio_id"`
BouncedHard string `json:"bounced_hard"`
BouncedSoft string `json:"bounced_soft"`
BouncedDate string `json:"bounced_date"`
IP string `json:"ip"`
Ua string `json:"ua"`
Hash string `json:"hash"`
SocialdataLastcheck string `json:"socialdata_lastcheck"`
EmailLocal string `json:"email_local"`
EmailDomain string `json:"email_domain"`
Sentcnt string `json:"sentcnt"`
RatingTstamp string `json:"rating_tstamp"`
Gravatar string `json:"gravatar"`
Deleted string `json:"deleted"`
Anonymized string `json:"anonymized"`
Adate string `json:"adate"`
Udate string `json:"udate"`
Edate interface{} `json:"edate"`
DeletedAt string `json:"deleted_at"`
CreatedUtcTimestamp string `json:"created_utc_timestamp"`
UpdatedUtcTimestamp string `json:"updated_utc_timestamp"`
CreatedTimestamp string `json:"created_timestamp"`
UpdatedTimestamp string `json:"updated_timestamp"`
CreatedBy string `json:"created_by"`
UpdatedBy string `json:"updated_by"`
EmailEmpty bool `json:"email_empty"`
AccountContacts []interface{} `json:"accountContacts"`
Links struct {
BounceLogs string `json:"bounceLogs"`
ContactAutomations string `json:"contactAutomations"`
ContactData string `json:"contactData"`
ContactGoals string `json:"contactGoals"`
ContactLists string `json:"contactLists"`
ContactLogs string `json:"contactLogs"`
ContactTags string `json:"contactTags"`
ContactDeals string `json:"contactDeals"`
Deals string `json:"deals"`
FieldValues string `json:"fieldValues"`
GeoIps string `json:"geoIps"`
Notes string `json:"notes"`
Organization string `json:"organization"`
PlusAppend string `json:"plusAppend"`
TrackingLogs string `json:"trackingLogs"`
ScoreValues string `json:"scoreValues"`
AutomationEntryCounts string `json:"automationEntryCounts"`
} `json:"links"`
ID string `json:"id"`
Organization interface{} `json:"organization"`
} `json:"contacts"`
FieldValue *FieldValue `json:"fieldValue"`
}
CreateCustomFieldValueResponse is the response body from updating a custom field value on a contact.
type CreateTagRequest ¶
type CreateTagRequest struct {
Tag *Tag `json:"tag"`
}
CreateTagRequest is the request body used for creating a tag.
type CreatedContact ¶
type CreatedContact struct {
Email string `json:"email"`
Cdate string `json:"cdate"`
Udate string `json:"udate"`
Orgid string `json:"orgid"`
Links struct {
BounceLogs string `json:"bounceLogs"`
ContactAutomations string `json:"contactAutomations"`
ContactData string `json:"contactData"`
ContactGoals string `json:"contactGoals"`
ContactLists string `json:"contactLists"`
ContactLogs string `json:"contactLogs"`
ContactTags string `json:"contactTags"`
ContactDeals string `json:"contactDeals"`
Deals string `json:"deals"`
FieldValues string `json:"fieldValues"`
GeoIps string `json:"geoIps"`
Notes string `json:"notes"`
Organization string `json:"organization"`
PlusAppend string `json:"plusAppend"`
TrackingLogs string `json:"trackingLogs"`
ScoreValues string `json:"scoreValues"`
} `json:"links"`
ID string `json:"id"`
Organization string `json:"organization"`
}
type CreatedTag ¶
type CreatedTag struct {
Tag string `json:"tag"`
Description string `json:"description"`
TagType string `json:"tagType"`
SubscriberCount string `json:"subscriber_count"`
Cdate string `json:"cdate"`
Links *Links `json:"links"`
ID string `json:"id"`
}
CreatedTag is a struct embedded in the response for creating or retrieving a tag.
type FieldValue ¶
type FieldValue struct {
Contact string `json:"contact"`
Field interface{} `json:"field"`
Value interface{} `json:"value"`
Cdate string `json:"cdate,omitempty"`
Udate string `json:"udate,omitempty"`
Links *struct {
Owner string `json:"owner,omitempty"`
Field string `json:"field,omitempty"`
} `json:"links,omitempty"`
ID string `json:"id,omitempty"`
Owner interface{} `json:"owner,omitempty"`
}
FieldValue stores a custom field value and the contact information it is attached to.
type Links ¶
type Links struct {
ContactGoalTags string `json:"contactGoalTags"`
}
Links is embedded in the CreatedTag struct.
type ListAllResponse ¶
type ListAllResponse struct {
Tags []*CreatedTag `json:"tags"`
Meta *Meta `json:"meta"`
}
ListAllResponse is the response body returned from listing all tags.
type Meta ¶
type Meta struct {
Total string `json:"total"`
}
Meta is embedded in the ListAllResponse struct.
type Response ¶
Response is a Active Campaign API response. This wraps the standard http.Response returned from Active Campaign.
type Tag ¶
type Tag struct {
Tag string `json:"tag,omitempty"`
TagType string `json:"tagType,omitempty"`
Description string `json:"description,omitempty"`
}
Tags are labels that you can apply to contacts to help you organize them. The API enables you to add, view, update, and delete tags.
type TagResponse ¶
type TagResponse struct {
Tag *CreatedTag `json:"tag"`
}
TagResponse is the response body returned from creating or retrieving a tag.
type TagsService ¶
type TagsService service
TagsService handles communication with tag related methods of the Active Campaign API.
Active Campaign API docs: https://developers.activecampaign.com/reference#tags
func (*TagsService) Create ¶
func (s *TagsService) Create(tag *CreateTagRequest) (*TagResponse, *Response, error)
Create a tag.
func (*TagsService) ListAll ¶
func (s *TagsService) ListAll() (*ListAllResponse, *Response, error)
Lists all tags.
func (*TagsService) Retrieve ¶
func (s *TagsService) Retrieve(id string) (*TagResponse, *Response, error)
Retrieve a tag.
type UpdateContactListStatusResponse ¶
type UpdateContactListStatusResponse struct {
Contacts []struct {
Cdate string `json:"cdate"`
Email string `json:"email"`
Phone string `json:"phone"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Orgid string `json:"orgid"`
Orgname string `json:"orgname"`
SegmentioID string `json:"segmentio_id"`
BouncedHard string `json:"bounced_hard"`
BouncedSoft string `json:"bounced_soft"`
BouncedDate string `json:"bounced_date"`
IP string `json:"ip"`
Ua string `json:"ua"`
Hash string `json:"hash"`
SocialdataLastcheck string `json:"socialdata_lastcheck"`
EmailLocal string `json:"email_local"`
EmailDomain string `json:"email_domain"`
Sentcnt string `json:"sentcnt"`
RatingTstamp string `json:"rating_tstamp"`
Gravatar string `json:"gravatar"`
Deleted string `json:"deleted"`
Anonymized string `json:"anonymized"`
Adate string `json:"adate"`
Udate string `json:"udate"`
Edate string `json:"edate"`
DeletedAt string `json:"deleted_at"`
CreatedUtcTimestamp string `json:"created_utc_timestamp"`
UpdatedUtcTimestamp string `json:"updated_utc_timestamp"`
CreatedTimestamp string `json:"created_timestamp"`
UpdatedTimestamp string `json:"updated_timestamp"`
CreatedBy string `json:"created_by"`
UpdatedBy string `json:"updated_by"`
Links struct {
BounceLogs string `json:"bounceLogs"`
ContactAutomations string `json:"contactAutomations"`
ContactData string `json:"contactData"`
ContactGoals string `json:"contactGoals"`
ContactLists string `json:"contactLists"`
ContactLogs string `json:"contactLogs"`
ContactTags string `json:"contactTags"`
ContactDeals string `json:"contactDeals"`
Deals string `json:"deals"`
FieldValues string `json:"fieldValues"`
GeoIps string `json:"geoIps"`
Notes string `json:"notes"`
Organization string `json:"organization"`
PlusAppend string `json:"plusAppend"`
TrackingLogs string `json:"trackingLogs"`
ScoreValues string `json:"scoreValues"`
AccountContacts string `json:"accountContacts"`
AutomationEntryCounts string `json:"automationEntryCounts"`
} `json:"links"`
ID string `json:"id"`
Organization interface{} `json:"organization"`
} `json:"contacts"`
ContactList struct {
Contact string `json:"contact"`
List string `json:"list"`
Form interface{} `json:"form"`
Seriesid string `json:"seriesid"`
Sdate string `json:"sdate"`
Udate interface{} `json:"udate"`
Status string `json:"status"`
Responder string `json:"responder"`
Sync string `json:"sync"`
Unsubreason string `json:"unsubreason"`
Campaign interface{} `json:"campaign"`
Message interface{} `json:"message"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
IP4Sub string `json:"ip4Sub"`
// Update list status for a contact does not return a uniform type for Sourceid.
// If a contact is not a member of the list, it will return a number. Otherwise, a string is returned.
Sourceid interface{} `json:"sourceid,string"`
AutosyncLog interface{} `json:"autosyncLog"`
IP4Last string `json:"ip4_last"`
IP4Unsub string `json:"ip4Unsub"`
CreatedTimestamp string `json:"created_timestamp"`
UpdatedTimestamp string `json:"updated_timestamp"`
CreatedBy interface{} `json:"created_by"`
UpdatedBy interface{} `json:"updated_by"`
UnsubscribeAutomation interface{} `json:"unsubscribeAutomation"`
Links struct {
Automation string `json:"automation"`
List string `json:"list"`
Contact string `json:"contact"`
Form string `json:"form"`
AutosyncLog string `json:"autosyncLog"`
Campaign string `json:"campaign"`
UnsubscribeAutomation string `json:"unsubscribeAutomation"`
Message string `json:"message"`
} `json:"links"`
ID string `json:"id"`
Automation interface{} `json:"automation"`
} `json:"contactList"`
}
type UpdateListStatusForContactRequest ¶
type UpdateListStatusForContactRequest struct {
ContactList *ContactList `json:"contactList"`
}