-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcrm_associations.go
120 lines (112 loc) · 3.89 KB
/
crm_associations.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package hubspot
const (
// CRMAssociationContactToCompany ...
CRMAssociationContactToCompany = 1
// CRMAssociationCompanyToContact ...
CRMAssociationCompanyToContact = 2
// CRMAssociationDealToContact ...
CRMAssociationDealToContact = 3
// CRMAssociationContactToDeal ...
CRMAssociationContactToDeal = 4
// CRMAssociationDealToCompany ...
CRMAssociationDealToCompany = 5
// CRMAssociationCompanyToDeal ...
CRMAssociationCompanyToDeal = 6
// CRMAssociationCompanyToEngagement ...
CRMAssociationCompanyToEngagement = 7
// CRMAssociationEngagementToCompany ...
CRMAssociationEngagementToCompany = 8
// CRMAssociationContactToEngagement ...
CRMAssociationContactToEngagement = 9
// CRMAssociationEngagementToContact ...
CRMAssociationEngagementToContact = 10
// CRMAssociationDealToEngagement ...
CRMAssociationDealToEngagement = 11
// CRMAssociationEngagementToDeal ...
CRMAssociationEngagementToDeal = 12
// CRMAssociationParentCompanyToChildCompany ...
CRMAssociationParentCompanyToChildCompany = 13
// CRMAssociationChildCompanyToParentCompany ...
CRMAssociationChildCompanyToParentCompany = 14
// CRMAssociationContactToTicket ...
CRMAssociationContactToTicket = 15
// CRMAssociationTicketToContact ...
CRMAssociationTicketToContact = 16
// CRMAssociationTicketToEngagement ...
CRMAssociationTicketToEngagement = 17
// CRMAssociationEngagementToTicket ...
CRMAssociationEngagementToTicket = 18
// CRMAssociationDealToLineItem ...
CRMAssociationDealToLineItem = 19
// CRMAssociationLineItemToDeal ...
CRMAssociationLineItemToDeal = 20
// CRMAssociationCompanyToTicket ...
CRMAssociationCompanyToTicket = 25
// CRMAssociationTicketToCompany ...
CRMAssociationTicketToCompany = 26
// CRMAssociationDealToTicket ...
CRMAssociationDealToTicket = 27
// CRMAssociationTicketToDeal ...
CRMAssociationTicketToDeal = 28
// CRMAssociationAdvisorToCompany ...
CRMAssociationAdvisorToCompany = 33
// CRMAssociationCompanyToAdvisor ...
CRMAssociationCompanyToAdvisor = 34
// CRMAssociationBoardMemberToCompany ...
CRMAssociationBoardMemberToCompany = 35
// CRMAssociationCompanyToBoardMember ...
CRMAssociationCompanyToBoardMember = 36
// CRMAssociationContractorToCompany ...
CRMAssociationContractorToCompany = 37
// CRMAssociationCompanyToContractor ...
CRMAssociationCompanyToContractor = 38
// CRMAssociationManagerToCompany ...
CRMAssociationManagerToCompany = 39
// CRMAssociationCompanyToManager ...
CRMAssociationCompanyToManager = 40
// CRMAssociationBusinessOwnerToCompany ...
CRMAssociationBusinessOwnerToCompany = 41
// CRMAssociationCompanyToBusinessOwner ...
CRMAssociationCompanyToBusinessOwner = 42
// CRMAssociationPartnerToCompany ...
CRMAssociationPartnerToCompany = 43
// CRMAssociationCompanyToPartner ...
CRMAssociationCompanyToPartner = 44
// CRMAssociationResellerToCompany ...
CRMAssociationResellerToCompany = 45
// CRMAssociationCompanyToReseller ...
CRMAssociationCompanyToReseller = 46
)
// CRMAssociations API client
type CRMAssociations struct {
Client
}
// CRMAssociations constructor (from Client)
func (c Client) CRMAssociations() CRMAssociations {
return CRMAssociations{
Client: c,
}
}
// CRMAssociationsRequest object
type CRMAssociationsRequest struct {
FromObjectID int `json:"fromObjectId"`
ToObjectID int `json:"toObjectId"`
Category string `json:"category"`
DefinitionID int `json:"definitionId"`
}
// Create new CRM Association
func (ca CRMAssociations) Create(data CRMAssociationsRequest) error {
// Validate Category
if data.Category == "" {
data.Category = "HUBSPOT_DEFINED"
}
return ca.Client.Request("PUT", "/crm-associations/v1/associations", data, nil)
}
// Delete CRM Association
func (ca CRMAssociations) Delete(data CRMAssociationsRequest) error {
// Validate Category
if data.Category == "" {
data.Category = "HUBSPOT_DEFINED"
}
return ca.Client.Request("PUT", "/crm-associations/v1/associations/delete", data, nil)
}