Documentation
¶
Index ¶
- func FindInPages(pager func(*Page) (*PageResponse, error), ...) (interface{}, error)
- type Association
- type AssociationType
- type Associations
- func (api *Associations) Create(fromid int64, toid int64, asstype AssociationType) error
- func (api *Associations) CreateBulk(data []*Association) error
- func (api *Associations) Delete(fromid int64, toid int64, asstype AssociationType) error
- func (api *Associations) DeleteBulk(data []*Association) error
- func (api *Associations) List(objectid int64, asstype AssociationType, page *Page) (*PageResponse, error)
- type Companies
- func (api *Companies) BatchUpdate(companies []interface{}) error
- func (api *Companies) Create(company interface{}) (interface{}, error)
- func (api *Companies) Delete(id int64) error
- func (api *Companies) Get(id int64) (interface{}, error)
- func (api *Companies) List(page *Page, props ...string) (*PageResponse, error)
- func (api *Companies) Query() IQuery
- func (api *Companies) RecentlyCreated(page *Page) (*PageResponse, error)
- func (api *Companies) RecentlyModified(page *Page) (*PageResponse, error)
- func (api *Companies) SearchByDomain(domain string, page *Page, props ...string) (*PageResponse, error)
- func (api *Companies) Update(id int64, company interface{}) (interface{}, error)
- type Contacts
- func (api *Contacts) CreateOrUpdate(email string, contact interface{}) (int64, error)
- func (api *Contacts) Delete(id int64) error
- func (api *Contacts) GetByEmail(email string) (interface{}, error)
- func (api *Contacts) GetByID(id int64) (interface{}, error)
- func (api *Contacts) ListPage(page *Page, props ...string) (*PageResponse, error)
- func (api *Contacts) Query() IQuery
- func (api *Contacts) Update(id int64, contact interface{}) error
- type Deals
- func (api *Deals) Create(deal interface{}) (interface{}, error)
- func (api *Deals) Delete(id int64) error
- func (api *Deals) Get(id int64) (interface{}, error)
- func (api *Deals) List(page *Page, includeassociations bool, props ...string) (*PageResponse, error)
- func (api *Deals) Query() IQuery
- func (api *Deals) RecentlyCreated(page *Page, since *time.Time, includeassociations bool) (*PageResponse, error)
- func (api *Deals) RecentlyModified(page *Page, since *time.Time, includeassociations bool) (*PageResponse, error)
- func (api *Deals) Update(id int64, deal interface{}) (interface{}, error)
- func (api *Deals) UpdateBulk(deals []interface{}) error
- type Filter
- func ContainsToken(property string) *Filter
- func Equals(property string, value interface{}) *Filter
- func Greater(property string, value interface{}) *Filter
- func GreaterEqual(property string, value interface{}) *Filter
- func HasProperty(property string) *Filter
- func Less(property string, value interface{}) *Filter
- func LessEqual(property string, value interface{}) *Filter
- func NotContainsToken(property string) *Filter
- func NotEquals(property string, value interface{}) *Filter
- func NotHasProperty(property string) *Filter
- type FilterGroup
- type IAssociations
- type ICompanies
- type IContacts
- type IDeals
- type IQuery
- type IRestClient
- type ITickets
- type Model
- type ModelProperty
- type Options
- type Page
- type PageResponse
- type Parameter
- type Query
- func (q *Query) Ascending(property string) IQuery
- func (q *Query) Descending(property string) IQuery
- func (q *Query) Execute(page *Page) (*PageResponse, error)
- func (q *Query) Properties(props ...string) IQuery
- func (q *Query) Text(text string) IQuery
- func (q *Query) Where(filters ...*Filter) IQuery
- type QueryData
- type RestClient
- func (client *RestClient) BeginQuota()
- func (client *RestClient) Delete(address string) error
- func (client *RestClient) EndQuota()
- func (client *RestClient) Get(address string, params ...*Parameter) (map[string]interface{}, error)
- func (client *RestClient) Post(address string, request interface{}, params ...*Parameter) (map[string]interface{}, error)
- func (client *RestClient) Put(address string, request interface{}, params ...*Parameter) (map[string]interface{}, error)
- type Sort
- type Tickets
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindInPages ¶ added in v0.2.6
func FindInPages(pager func(*Page) (*PageResponse, error), predicate func(data interface{}) (bool, error)) (interface{}, error)
FindInPages - finds an item in results of a paging mechanism
Types ¶
type Association ¶
type Association struct {
From int64
To int64
Type AssociationType
}
Association - association of objects in hubspot
type AssociationType ¶
type AssociationType int8
AssociationType - type of data association
const ( AssociationContactToCompany AssociationType = 1 AssociationCompanyToContact AssociationType = 2 AssociationDealToContact AssociationType = 3 AssociationContactToDeal AssociationType = 4 AssociationDealToCompany AssociationType = 5 AssociationCompanyToDeal AssociationType = 6 AssociationCompanyToEngagement AssociationType = 7 AssociationEngagementToCompany AssociationType = 8 AssociationContactToEngagement AssociationType = 9 AssociationEngagementToContact AssociationType = 10 AssociationDealToEngagement AssociationType = 11 AssociationEngagementToDeal AssociationType = 12 AssociationParentCompanyToChildCompany AssociationType = 13 AssociationChildCompanyToParentCompany AssociationType = 14 AssociationContactToTicket AssociationType = 15 AssociationTicketToContact AssociationType = 16 AssociationTicketToEngagement AssociationType = 17 AssociationEngagementToTicket AssociationType = 18 AssociationDealToLineItem AssociationType = 19 AssociationLineItemToDeal AssociationType = 20 AssociationCompanyToTicket AssociationType = 25 AssociationTicketToCompany AssociationType = 26 AssociationDealToTicket AssociationType = 27 AssociationTicketToDeal AssociationType = 28 AssociationAdvisorToCompany AssociationType = 33 AssociationCompanyToAdvisor AssociationType = 34 AssociationBoardMemberToCompany AssociationType = 35 AssociationCompanyToBoardMember AssociationType = 36 AssociationContractorToCompany AssociationType = 37 AssociationCompanyToContractor AssociationType = 38 AssociationManagerToCompany AssociationType = 39 AssociationCompanyToManager AssociationType = 40 AssociationBusinessOwnerToCompany AssociationType = 41 AssociationCompanyToBusinessOwner AssociationType = 42 AssociationPartnerToCompany AssociationType = 43 AssociationCompanyToPartner AssociationType = 44 AssociationResellerToCompany AssociationType = 45 AssociationCompanyToReseller AssociationType = 46 )
type Associations ¶
type Associations struct {
// contains filtered or unexported fields
}
Associations - hubspot associations api using rest
func NewAssociations ¶ added in v0.2.0
func NewAssociations(rest IRestClient) *Associations
NewAssociations - creates a new associations api
func (*Associations) Create ¶
func (api *Associations) Create(fromid int64, toid int64, asstype AssociationType) error
Create - creates a new association of two objects in hubspot
func (*Associations) CreateBulk ¶
func (api *Associations) CreateBulk(data []*Association) error
CreateBulk - creates multiple associations in one call
func (*Associations) Delete ¶
func (api *Associations) Delete(fromid int64, toid int64, asstype AssociationType) error
Delete - deletes an object association
func (*Associations) DeleteBulk ¶
func (api *Associations) DeleteBulk(data []*Association) error
DeleteBulk - deletes multiple associations at once
func (*Associations) List ¶
func (api *Associations) List(objectid int64, asstype AssociationType, page *Page) (*PageResponse, error)
List - lists associations of a type for an object
type Companies ¶
type Companies struct {
// contains filtered or unexported fields
}
Companies - access to companies api of hubspot using http
func NewCompanies ¶
func NewCompanies(rest IRestClient, model *Model) *Companies
NewCompanies - creates a new companies api
func (*Companies) BatchUpdate ¶
BatchUpdate - updates multiple companies in hubspot in a single call
func (*Companies) List ¶
func (api *Companies) List(page *Page, props ...string) (*PageResponse, error)
List - lists a page of companies in hubspot
func (*Companies) RecentlyCreated ¶
func (api *Companies) RecentlyCreated(page *Page) (*PageResponse, error)
RecentlyCreated - get a list of recently created companies
func (*Companies) RecentlyModified ¶
func (api *Companies) RecentlyModified(page *Page) (*PageResponse, error)
RecentlyModified - get recently modified companies
func (*Companies) SearchByDomain ¶
func (api *Companies) SearchByDomain(domain string, page *Page, props ...string) (*PageResponse, error)
SearchByDomain - lists companies by filtering for their domain
type Contacts ¶
type Contacts struct {
// contains filtered or unexported fields
}
Contacts - hubspot contacts api
func NewContacts ¶
func NewContacts(rest IRestClient, model *Model) *Contacts
NewContacts - creates a new contacts api
func (*Contacts) CreateOrUpdate ¶
CreateOrUpdate - creates or updates a contact in hubspot
func (*Contacts) GetByEmail ¶
GetByEmail - get contact information by email
func (*Contacts) ListPage ¶
func (api *Contacts) ListPage(page *Page, props ...string) (*PageResponse, error)
ListPage - lists a page of contact listing in hubspot
type Deals ¶ added in v0.2.0
type Deals struct {
// contains filtered or unexported fields
}
Deals - rest implementation of hubspot deals api
func NewDeals ¶ added in v0.2.0
func NewDeals(rest IRestClient, model *Model) *Deals
NewDeals - creates a new deals api
func (*Deals) List ¶ added in v0.2.0
func (api *Deals) List(page *Page, includeassociations bool, props ...string) (*PageResponse, error)
List - lists a page of deals from hubspot
func (*Deals) RecentlyCreated ¶ added in v0.2.0
func (api *Deals) RecentlyCreated(page *Page, since *time.Time, includeassociations bool) (*PageResponse, error)
RecentlyCreated - lists a page of recently created deals
func (*Deals) RecentlyModified ¶ added in v0.2.0
func (api *Deals) RecentlyModified(page *Page, since *time.Time, includeassociations bool) (*PageResponse, error)
RecentlyModified - lists a page of recently modified deals
func (*Deals) UpdateBulk ¶ added in v0.2.0
UpdateBulk - updates multiple deal entries in hubspot
type Filter ¶ added in v0.3.0
type Filter struct {
PropertyName string `json:"propertyName"`
Operator string `json:"operator"`
Value interface{} `json:"value,omitempty"`
}
Filter - a filter for a property filters are combined using AND by hubspot
func ContainsToken ¶ added in v0.3.0
func GreaterEqual ¶ added in v0.3.0
func HasProperty ¶ added in v0.3.0
func NotContainsToken ¶ added in v0.3.0
func NotEquals ¶ added in v0.3.0
NotEquals - creates a filter which checks whether a property does not equal a value
func NotHasProperty ¶ added in v0.3.0
type FilterGroup ¶ added in v0.3.0
type FilterGroup struct {
Filters []*Filter `json:"filters"`
}
FilterGroup - specifies a group of filters filter groups are combined using OR by hubspot
type IAssociations ¶
type IAssociations interface {
Create(fromid int64, toid int64, asstype AssociationType) error
CreateBulk(data []*Association) error
List(objectid int64, asstype AssociationType, page *Page) (*PageResponse, error)
Delete(fromid int64, toid int64, asstype AssociationType) error
DeleteBulk(data []*Association) error
}
IAssociations - interface for associations api
type ICompanies ¶
type ICompanies interface {
Create(company interface{}) (interface{}, error)
Update(id int64, company interface{}) (interface{}, error)
BatchUpdate(companies []interface{}) error
List(page *Page, props ...string) (*PageResponse, error)
RecentlyModified(page *Page) (*PageResponse, error)
RecentlyCreated(page *Page) (*PageResponse, error)
SearchByDomain(domain string, page *Page, props ...string) (*PageResponse, error)
Delete(id int64) error
Get(id int64) (interface{}, error)
Query() IQuery
}
ICompanies - access to companies api of hubspot
type IContacts ¶
type IContacts interface {
CreateOrUpdate(email string, contact interface{}) (int64, error)
Update(id int64, contact interface{}) error
Delete(id int64) error
ListPage(page *Page, props ...string) (*PageResponse, error)
GetByID(id int64) (interface{}, error)
GetByEmail(email string) (interface{}, error)
Query() IQuery
}
IContacts - interface for the hubspot contact api
type IDeals ¶ added in v0.2.0
type IDeals interface {
Create(deal interface{}) (interface{}, error)
Update(id int64, deal interface{}) (interface{}, error)
UpdateBulk(deals []interface{}) error
List(page *Page, includeassociations bool, props ...string) (*PageResponse, error)
RecentlyModified(page *Page, since *time.Time, includeassociations bool) (*PageResponse, error)
RecentlyCreated(page *Page, since *time.Time, includeassociations bool) (*PageResponse, error)
Delete(id int64) error
Get(id int64) (interface{}, error)
Query() IQuery
}
IDeals - interface for deals api
type IQuery ¶ added in v0.3.0
type IQuery interface {
Where(filter ...*Filter) IQuery
Properties(props ...string) IQuery
Ascending(property string) IQuery
Descending(property string) IQuery
Execute(*Page) (*PageResponse, error)
}
IQuery - query for crm data
type IRestClient ¶
type IRestClient interface {
Post(url string, request interface{}, params ...*Parameter) (map[string]interface{}, error)
Put(url string, request interface{}, params ...*Parameter) (map[string]interface{}, error)
Delete(url string) error
Get(url string, params ...*Parameter) (map[string]interface{}, error)
BeginQuota()
EndQuota()
}
IRestClient - interface for a client sending rest requests to hubspot
type ITickets ¶ added in v0.2.0
type ITickets interface {
Create(ticket interface{}) (interface{}, error)
Get(id int64) (interface{}, error)
Query() IQuery
}
ITickets - access to tickets-api in hubspot
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model - model for hubspot entity mapping
func NewModel ¶
NewModel - creates a new model for an entity use tag values for 'hubspot' to specify hubspot properties. If no hubspot tag is specified the field name in all lower cases is used as fieldname on hubspot as default
name=<string> - specify hubspot field name id - transfer hubspot entity id to this field deleted - transfer deleted flag to this field noexport - don't export this field to hubspot on create/update
func (*Model) GetCompanies ¶ added in v0.2.0
GetCompanies - get linked companies of a deal
func (*Model) GetContacts ¶ added in v0.2.0
GetContacts - get linked contacts of a deal
func (*Model) GetID ¶
func (mdl *Model) GetID(entity interface{}) interface{}
GetID - get id of an entity
func (*Model) GetProperty ¶
func (mdl *Model) GetProperty(name string) *ModelProperty
GetProperty - get property of model
type ModelProperty ¶
ModelProperty - property in a hubspot model
func (*ModelProperty) GetValue ¶
func (prop *ModelProperty) GetValue(entity reflect.Value) interface{}
GetValue - get value of a property
type PageResponse ¶
PageResponse - response of a list page request
type Parameter ¶
Parameter - parameter for a rest client
func NewParameter ¶
NewParameter - creates a new parameter
type Query ¶ added in v0.3.0
type Query struct {
// contains filtered or unexported fields
}
Query - a query for data in hubspot
func (*Query) Descending ¶ added in v0.3.0
Descending - creates a sort criteria in descending order
func (*Query) Execute ¶ added in v0.3.0
func (q *Query) Execute(page *Page) (*PageResponse, error)
Execute - executes the query and returns the result
func (*Query) Properties ¶ added in v0.3.0
Properties - specified properties to return in result objects if this is not specified only a default set of properties is returned for every object
func (*Query) Where ¶ added in v0.3.0
Where - specifies a filter to query for Use the following methods to create filters
Equal - property has to be equal to a value NotEqual - property must not equal a value Less - property has to be less than a value LessEqual - property has to be less or equal to a value Greater - property has to be greater than a value GreaterEqual - property has to be greater or equal to a value HasProperty - object has to contain a property NotHasProperty - object must not contain a property (value) ContainsToken - object must contain a token NotContainsToken - object must not contain a token
All filters in a single call are combined using AND. Every following call is combined with OR to the other calls.
type QueryData ¶ added in v0.3.0
type QueryData struct {
Limit int `json:"limit,omitempty"`
After string `json:"after,omitempty"`
Properties []string `json:"properties,omitempty"` // properties to return
Sorts []*Sort `json:"sorts,omitempty"`
Text string `json:"query,omitempty"`
// filters and filtergroups are mutually exclusive properties
Filters []*Filter `json:"filters,omitempty"`
FilterGroups []*FilterGroup `json:"filterGroups,omitempty"`
}
QueryData - data send to a hubspot query endpoint
type RestClient ¶
type RestClient struct {
// contains filtered or unexported fields
}
RestClient - client used to send rest requests to hubspot
func NewRest ¶
func NewRest(address string, apikey string) *RestClient
NewRest - creates a new rest client
func (*RestClient) BeginQuota ¶ added in v0.3.0
func (client *RestClient) BeginQuota()
BeginQuota - starts a quota call and waits until the next call is valid Always call EndQuota after a call to BeginQuota since sync involves a mutex which would deadlock otherwise this is used for queries since currently they are rate limited to 1 query per second
func (*RestClient) Delete ¶
func (client *RestClient) Delete(address string) error
Delete - send a DELETE request to hubspot
func (*RestClient) EndQuota ¶ added in v0.3.0
func (client *RestClient) EndQuota()
EndQuota - ends a quota call
func (*RestClient) Get ¶
func (client *RestClient) Get(address string, params ...*Parameter) (map[string]interface{}, error)
Get - send a GET request to hubspot
type Tickets ¶ added in v0.2.0
type Tickets struct {
// contains filtered or unexported fields
}
Tickets - access to tickets-api using rest
func NewTickets ¶ added in v0.2.0
func NewTickets(rest IRestClient, model *Model) *Tickets
NewTickets - creates a new tickets api