@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.
@@ -0,0 +1,8 @@
1
+ import { AssociationSpec } from "@hubspot/api-client/lib/codegen/crm/companies";
2
+ export interface AssociateObjectInput {
3
+ objectTypeFirst: string;
4
+ objectTypeSecond: string;
5
+ objectIdFirst: string;
6
+ objectIdSecond: string;
7
+ options: AssociationSpec[];
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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(objectTypeFirst: string, objectTypeSecond: string, objectIdFirst: string, objectIdSecond: string, accessToken: string): Promise<LabelsBetweenObjectPair>;
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(objectTypeFirst, objectTypeSecond, objectIdFirst, objectIdSecond, accessToken) {
123
+ async associateObjects(commandInput, accessToken) {
124
124
  this.client.setAccessToken(accessToken);
125
- const response = await this.client.crm.associations.v4.basicApi.create(objectTypeFirst, objectIdFirst, objectTypeSecond, objectIdSecond, []);
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) {
@@ -0,0 +1,9 @@
1
+ import { AssociationSpec } from "@hubspot/api-client/lib/codegen/crm/companies";
2
+
3
+ export interface AssociateObjectInput {
4
+ objectTypeFirst: string,
5
+ objectTypeSecond: string,
6
+ objectIdFirst: string,
7
+ objectIdSecond: string,
8
+ options: AssociationSpec[]
9
+ }
@@ -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
- objectTypeFirst: string,
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dma-sdk/hubspot",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "DMA SDK – Hubspot service",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",