@dma-sdk/hubspot 1.0.21 → 1.0.22

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.
@@ -20,3 +20,8 @@ export interface AssociationsObject {
20
20
  };
21
21
  types: Array<AssociationSpec>;
22
22
  }
23
+ export interface BatchListAssociationsInput {
24
+ firstObjectType: string;
25
+ firstObjectId: string;
26
+ secondObjectType: string;
27
+ }
@@ -2,7 +2,7 @@ import { HubspotUser } from '../interfaces/user';
2
2
  import { Configuration } from '@hubspot/api-client/lib/codegen/crm/objects';
3
3
  import { SimplePublicObjectInputForCreate } from '@hubspot/api-client/lib/codegen/crm/objects/taxes/models/all';
4
4
  import { SimplePublicObject } from '@hubspot/api-client/lib/codegen/crm/objects/tasks/models/all';
5
- import { LabelsBetweenObjectPair } from '@hubspot/api-client/lib/codegen/crm/associations/v4';
5
+ import { CollectionResponseMultiAssociatedObjectWithLabelForwardPaging, LabelsBetweenObjectPair } from '@hubspot/api-client/lib/codegen/crm/associations/v4';
6
6
  import { TokenResponseIF } from '@hubspot/api-client/lib/codegen/oauth';
7
7
  import { TokenResponse } from '../interfaces/token';
8
8
  import { CollectionResponsePropertyNoPaging, PropertyCreate, PropertyGroup, PropertyGroupCreate } from '@hubspot/api-client/lib/codegen/crm/properties';
@@ -10,7 +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, SimplePublicObjectWithAssociations } from '@hubspot/api-client/lib/codegen/crm/companies';
13
- import { AssociateObjectInput, BatchAssociateObjectInput } from '../interfaces/input/associations';
13
+ import { AssociateObjectInput, BatchAssociateObjectInput, BatchListAssociationsInput } from '../interfaces/input/associations';
14
14
  export declare class HubspotService {
15
15
  static HS_BASE_URL: string;
16
16
  static readonly hubspotObjectType: {
@@ -93,6 +93,7 @@ export declare class HubspotService {
93
93
  updateObject(objectType: string, objectId: string, properties: {
94
94
  [key: string]: string;
95
95
  }, accessToken: string, options?: Configuration): Promise<SimplePublicObject>;
96
+ listAssociations(commandInput: BatchListAssociationsInput, accessToken: string): Promise<CollectionResponseMultiAssociatedObjectWithLabelForwardPaging>;
96
97
  associateObjects(commandInput: AssociateObjectInput, accessToken: string): Promise<LabelsBetweenObjectPair>;
97
98
  associateObjectsBatch(commandInput: BatchAssociateObjectInput, accessToken: string): Promise<{
98
99
  errors: string[];
@@ -127,6 +127,11 @@ class HubspotService {
127
127
  });
128
128
  return response;
129
129
  }
130
+ async listAssociations(commandInput, accessToken) {
131
+ this.client.setAccessToken(accessToken);
132
+ const response = await this.client.crm.associations.v4.basicApi.getPage(commandInput.firstObjectType, commandInput.firstObjectId, commandInput.secondObjectType);
133
+ return response;
134
+ }
130
135
  async associateObjects(commandInput, accessToken) {
131
136
  this.client.setAccessToken(accessToken);
132
137
  const { objectTypeFirst, objectTypeSecond, objectIdFirst, objectIdSecond, options } = commandInput;
@@ -23,4 +23,11 @@ export interface AssociationsObject {
23
23
  id: string
24
24
  },
25
25
  types: Array<AssociationSpec>
26
+ }
27
+
28
+
29
+ export interface BatchListAssociationsInput {
30
+ firstObjectType: string,
31
+ firstObjectId: string,
32
+ secondObjectType: string,
26
33
  }
@@ -3,7 +3,7 @@ import { HubspotUser } from '../interfaces/user'
3
3
  import { Configuration, Filter } from '@hubspot/api-client/lib/codegen/crm/objects'
4
4
  import { SimplePublicObjectInputForCreate } from '@hubspot/api-client/lib/codegen/crm/objects/taxes/models/all'
5
5
  import { SimplePublicObject } from '@hubspot/api-client/lib/codegen/crm/objects/tasks/models/all'
6
- import { LabelsBetweenObjectPair } from '@hubspot/api-client/lib/codegen/crm/associations/v4'
6
+ import { CollectionResponseMultiAssociatedObjectWithLabelForwardPaging, LabelsBetweenObjectPair } from '@hubspot/api-client/lib/codegen/crm/associations/v4'
7
7
  import { PromiseConfigurationOptions, TokenResponseIF } from '@hubspot/api-client/lib/codegen/oauth'
8
8
  import { typeConverter } from '../utils/type-converter'
9
9
  import { HubspotTypeConverter } from '../interfaces/hubspot-type-converter'
@@ -17,7 +17,7 @@ import { ApiMethods } from '../constants/api'
17
17
  import { CreateSubscriptionInput } from '../interfaces/input/subscriptions'
18
18
  import { CreateSubscriptionOutput } from '../interfaces/output/subscriptions'
19
19
  import { PublicObjectSearchRequest, SimplePublicObjectWithAssociations } from '@hubspot/api-client/lib/codegen/crm/companies'
20
- import { AssociateObjectInput, AssociationsObject, BatchAssociateObjectInput } from '../interfaces/input/associations'
20
+ import { AssociateObjectInput, AssociationsObject, BatchAssociateObjectInput, BatchListAssociationsInput } from '../interfaces/input/associations'
21
21
  import { SystemError } from '../exceptions/system-error'
22
22
 
23
23
  // Per ogni metodo che viene creato, è fondamentale che
@@ -234,6 +234,20 @@ export class HubspotService {
234
234
  return response
235
235
  }
236
236
 
237
+ async listAssociations(
238
+ commandInput: BatchListAssociationsInput,
239
+ accessToken: string
240
+ ): Promise<CollectionResponseMultiAssociatedObjectWithLabelForwardPaging> {
241
+ this.client.setAccessToken(accessToken)
242
+ const response = await this.client.crm.associations.v4.basicApi.getPage(
243
+ commandInput.firstObjectType,
244
+ commandInput.firstObjectId,
245
+ commandInput.secondObjectType
246
+ )
247
+
248
+ return response
249
+ }
250
+
237
251
  async associateObjects(
238
252
  commandInput: AssociateObjectInput,
239
253
  accessToken: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dma-sdk/hubspot",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "DMA SDK – Hubspot service",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",