@dma-sdk/hubspot 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/interfaces/input/associations.d.ts +8 -0
- package/dist/interfaces/input/associations.js +2 -0
- package/dist/services/hubspot-service.d.ts +2 -1
- package/dist/services/hubspot-service.js +3 -2
- package/lib/interfaces/input/associations.ts +9 -0
- package/lib/services/hubspot-service.ts +5 -6
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ import { HubspotSignatureData } from '../types/auth/hs-signature-data';
|
|
|
10
10
|
import { CreateSubscriptionInput } from '../interfaces/input/subscriptions';
|
|
11
11
|
import { CreateSubscriptionOutput } from '../interfaces/output/subscriptions';
|
|
12
12
|
import { PublicObjectSearchRequest } from '@hubspot/api-client/lib/codegen/crm/companies';
|
|
13
|
+
import { AssociateObjectInput } from '../interfaces/input/associations';
|
|
13
14
|
export declare class HubspotService {
|
|
14
15
|
static HS_BASE_URL: string;
|
|
15
16
|
static readonly hubspotObjectType: {
|
|
@@ -82,7 +83,7 @@ export declare class HubspotService {
|
|
|
82
83
|
updateObject(objectType: string, objectId: string, properties: {
|
|
83
84
|
[key: string]: string;
|
|
84
85
|
}, accessToken: string, options?: Configuration): Promise<SimplePublicObject>;
|
|
85
|
-
associateObjects(
|
|
86
|
+
associateObjects(commandInput: AssociateObjectInput, accessToken: string): Promise<LabelsBetweenObjectPair>;
|
|
86
87
|
createObjectProperties(objectType: string, properties: PropertyCreate[], accessToken: string): Promise<any>;
|
|
87
88
|
createPropertyGroup(objectType: string, group: PropertyGroupCreate, accessToken: string): Promise<PropertyGroup>;
|
|
88
89
|
convertPropertyValues(properties: {
|
|
@@ -120,9 +120,10 @@ class HubspotService {
|
|
|
120
120
|
});
|
|
121
121
|
return response;
|
|
122
122
|
}
|
|
123
|
-
async associateObjects(
|
|
123
|
+
async associateObjects(commandInput, accessToken) {
|
|
124
124
|
this.client.setAccessToken(accessToken);
|
|
125
|
-
const
|
|
125
|
+
const { objectTypeFirst, objectTypeSecond, objectIdFirst, objectIdSecond, options } = commandInput;
|
|
126
|
+
const response = await this.client.crm.associations.v4.basicApi.create(objectTypeFirst, objectIdFirst, objectTypeSecond, objectIdSecond, options);
|
|
126
127
|
return response;
|
|
127
128
|
}
|
|
128
129
|
async createObjectProperties(objectType, properties, accessToken) {
|
|
@@ -16,7 +16,8 @@ import { fetchApi } from '@dma-sdk/utils'
|
|
|
16
16
|
import { ApiMethods } from '../constants/api'
|
|
17
17
|
import { CreateSubscriptionInput } from '../interfaces/input/subscriptions'
|
|
18
18
|
import { CreateSubscriptionOutput } from '../interfaces/output/subscriptions'
|
|
19
|
-
import { FilterGroup, PublicObjectSearchRequest } from '@hubspot/api-client/lib/codegen/crm/companies'
|
|
19
|
+
import { AssociationSpec, FilterGroup, PublicObjectSearchRequest } from '@hubspot/api-client/lib/codegen/crm/companies'
|
|
20
|
+
import { AssociateObjectInput } from '../interfaces/input/associations'
|
|
20
21
|
|
|
21
22
|
// Per ogni metodo che viene creato, è fondamentale che
|
|
22
23
|
// il client venga inizializzato con il token di accesso o l'api key
|
|
@@ -227,19 +228,17 @@ export class HubspotService {
|
|
|
227
228
|
}
|
|
228
229
|
|
|
229
230
|
async associateObjects(
|
|
230
|
-
|
|
231
|
-
objectTypeSecond: string,
|
|
232
|
-
objectIdFirst: string,
|
|
233
|
-
objectIdSecond: string,
|
|
231
|
+
commandInput: AssociateObjectInput,
|
|
234
232
|
accessToken: string
|
|
235
233
|
): Promise<LabelsBetweenObjectPair> {
|
|
236
234
|
this.client.setAccessToken(accessToken)
|
|
235
|
+
const { objectTypeFirst, objectTypeSecond, objectIdFirst, objectIdSecond, options } = commandInput
|
|
237
236
|
const response = await this.client.crm.associations.v4.basicApi.create(
|
|
238
237
|
objectTypeFirst,
|
|
239
238
|
objectIdFirst,
|
|
240
239
|
objectTypeSecond,
|
|
241
240
|
objectIdSecond,
|
|
242
|
-
|
|
241
|
+
options
|
|
243
242
|
)
|
|
244
243
|
|
|
245
244
|
return response
|