Documentation
¶
Index ¶
- Constants
- func CreateNewEventType(input *EventType) error
- func CreateOrUpdateContact(contact *Contact) error
- func CreateOrUpdateEvent(input *Event) error
- func DeleteContactByVID(vid int64) error
- func DeleteEventTypeByID(eventTypeID int64) error
- type APIError
- type APIReturn
- type ConfigStruct
- type Contact
- type ContactProperty
- type Event
- type EventIFrame
- type EventType
- type OAuthResponse
- type OAuthToken
Constants ¶
const ( EndpointCreateContact = "endpointCreateContact" EndpointGetContact = "endpointGetContact" EndpointDeleteContact = "endpointDeleteContact" EndpointCreateEventType = "endpointCreateEventType" EndpointDeleteEventType = "endpointDeleteEventType" EndpointCreateEvent = "endpointCreateEvent" )
Endpoints represent specific calls to the Hubspot API and some meta data about them. These should largely be ignored by the consumer of the API
const ( CodeContactCouldNotBeCreated = "the contact could not be created at hubspot; you should check the Message field" CodeContactNoEmail = "you failed to specify an email for that contact" CodeContactNotFound = "contact could not be found" CodeContactVIDZero = "the contact VID cannot be 0 for this action" CodeEventTypeCouldNotBeCreated = "the event type could not be created" CodeEventTypeMissingData = "the input is missing required information" CodeEventTypeCouldNotBeDeleted = "that event type could not be deleted" CodeEventCouldNotBeCreated = "the event could not be created" CodeEventMissingData = "the input is missing required information" CodeGeneralError = "a general error occurred" )
System codes are used to convey specific statuses in return objects
Variables ¶
This section is empty.
Functions ¶
func CreateNewEventType ¶
CreateNewEventType creates a new event type for events on the timeline
API Doc: https://developers.hubspot.com/docs/methods/timeline/create-event-type
func CreateOrUpdateContact ¶
CreateOrUpdateContact creates or updates a contact using an email address and additional properties. If the VID is 0, it is assumed that the user has not been created or updated yet.
API Doc: https://developers.hubspot.com/docs/methods/contacts/create_or_update
func CreateOrUpdateEvent ¶
CreateOrUpdateEvent creates or update an event on the timeline. The ID should be provided externally. If it isn't, this func will generate a random ID based upon the current timestamp. This returns no data since the return header is a 204
API Doc: https://developers.hubspot.com/docs/methods/timeline/create-or-update-event
func DeleteContactByVID ¶
DeleteContactByVID deletes a single contact by it's VID
API Doc: https://developers.hubspot.com/docs/methods/contacts/delete_contact
func DeleteEventTypeByID ¶
DeleteEventTypeByID deletes an event type by the id
API Doc: https://developers.hubspot.com/docs/methods/timeline/delete-event-type
Types ¶
type APIError ¶
APIError is the error struct containing additional information regarding the error that occurred. The HTTPCode is the returned value from Hubspot OR a 400 if there was an error prior to calling Hubspot. The SystemCode is a constant and you can check systemCodes.go for more information.
type APIReturn ¶
type APIReturn struct { HTTPCode int Body interface{} }
APIReturn represents a successful API return value, with the HTTPCode representing the exact returned HTTP Code and the Body representing the returned body
type ConfigStruct ¶
type ConfigStruct struct { Environment string RootURL string HubspotAPIKey string Logging bool // Certain API endpoints require an OAuth application; those are specified here HubspotApplicationID string HubspotUserID string HubspotClientID string HubspotClientSecret string HubSpotOAuthRefreshToken string }
ConfigStruct holds the various configuration options
var Config *ConfigStruct
Config is the global configuration object that holds global configuration settings
func ConfigSetup ¶
func ConfigSetup() *ConfigStruct
ConfigSetup sets up the config struct with data from the environment
type Contact ¶
type Contact struct { VID int64 Email string FirstName string LastName string Website string Company string Phone string Address string City string State string Zip string AdditionalProperties *[]ContactProperty }
Contact is an individual person that you would like to create or update in Hubspot. Email is the only required field. By default, the VID field will be 0. After a create call, the VID will be filled in for you. Additional porperties are tricky
func GetContactByEmail ¶
GetContactByEmail gets a single contact by their email address
API Doc: https://developers.hubspot.com/docs/methods/contacts/get_contact_by_email
type ContactProperty ¶
type Event ¶
type Event struct { ID string `json:"id"` // The VID of the contact ObjectID int64 `json:"objectId"` EventTypeID int64 `json:"eventTypeId"` ExtraData *map[string]string `json:"extraData,omitempty"` TimelineIFrame *EventIFrame `json:"timelineIFrame,omitempty"` }
Event represents a timeline event
type EventIFrame ¶
type EventIFrame struct { LinkLabel string `json:"linkLabel"` IFrameLabel string `json:"iframeLabel"` IFrameURI string `json:"iframeUri"` Width int `json:"width"` Height int `json:"height"` }
EventIFrame represent an event IFrame which will open an iframe in the display of the timeline event. All fields are needed.
type EventType ¶
type EventType struct { ID int64 `json:"id,omitempty"` Name string `json:"name"` // HeaderTemplate is used when displaying the event in the timeline and uses Handlebars.js templating HeaderTemplate string `json:"headerTemplate"` // DetailTemplate is used when displaying the event in the timeline and uses Handlebars.js templating DetailTemplate string `json:"detailTemplate"` ApplicationID string `json:"applicationId"` // ObjectType should be one of `CONTACT` `COMPANY` `DEAL` ObjectType string `json:"objectType"` }
EventType represents an event type used for adding events to the timeline
type OAuthResponse ¶
type OAuthResponse struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` ExpiresIn int `json:"expires_in"` TokenType string `json:"token_type"` }
OAuthResponse represents the oAuth response when trying to refresh a token
type OAuthToken ¶
OAuthToken represents a current oAuth token for accessing calls requiring oAuth