@friggframework/api-module-hubspot 1.1.7-canary.eaa7127.0 → 1.1.8-canary.88be3bc.0
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/CHANGELOG.md +17 -0
- package/api.js +14 -3
- package/defaultConfig.json +1 -1
- package/package.json +6 -5
- package/tests/api.test.js +22 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
# v1.1.7 (Tue Aug 06 2024)
|
|
2
|
+
|
|
3
|
+
:tada: This release contains work from a new contributor! :tada:
|
|
4
|
+
|
|
5
|
+
Thank you, Fer Riffel ([@FerRiffel-LeftHook](https://github.com/FerRiffel-LeftHook)), for all your work!
|
|
6
|
+
|
|
7
|
+
#### 🐛 Bug Fix
|
|
8
|
+
|
|
9
|
+
- Updated icons for all Frigg API modules [#14](https://github.com/friggframework/api-module-library/pull/14) ([@FerRiffel-LeftHook](https://github.com/FerRiffel-LeftHook))
|
|
10
|
+
- Update icons for all Frigg API modules ([@FerRiffel-LeftHook](https://github.com/FerRiffel-LeftHook))
|
|
11
|
+
|
|
12
|
+
#### Authors: 1
|
|
13
|
+
|
|
14
|
+
- Fer Riffel ([@FerRiffel-LeftHook](https://github.com/FerRiffel-LeftHook))
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
1
18
|
# v1.1.6 (Thu Aug 01 2024)
|
|
2
19
|
|
|
3
20
|
:tada: This release contains work from new contributors! :tada:
|
package/api.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const {OAuth2Requester, get} = require('@friggframework/core');
|
|
2
|
+
const {Paginator} = require('avid-reader');
|
|
2
3
|
|
|
3
4
|
class Api extends OAuth2Requester {
|
|
4
5
|
constructor(params) {
|
|
@@ -71,7 +72,6 @@ class Api extends OAuth2Requester {
|
|
|
71
72
|
listMembershipsAddRemove: (listId) => `/crm/v3/lists/${listId}/memberships/add-and-remove`,
|
|
72
73
|
associations: (fromObject, toObject) => `/crm/v4/associations/${fromObject}/${toObject}`,
|
|
73
74
|
associationLabels: (fromObject, toObject) => `/crm/v4/associations/${fromObject}/${toObject}/labels`,
|
|
74
|
-
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
this.authorizationUri = encodeURI(
|
|
@@ -81,6 +81,16 @@ class Api extends OAuth2Requester {
|
|
|
81
81
|
|
|
82
82
|
this.access_token = get(params, 'access_token', null);
|
|
83
83
|
this.refresh_token = get(params, 'refresh_token', null);
|
|
84
|
+
this.paginator = new Paginator(
|
|
85
|
+
this,
|
|
86
|
+
{
|
|
87
|
+
type: 'token',
|
|
88
|
+
tokenParam: 'after',
|
|
89
|
+
tokenPath: '/paging/next/after',
|
|
90
|
+
resultsKey: 'results',
|
|
91
|
+
args: { limit:100, after: 0 },
|
|
92
|
+
}
|
|
93
|
+
);
|
|
84
94
|
}
|
|
85
95
|
|
|
86
96
|
getAuthUri() {
|
|
@@ -217,11 +227,12 @@ class Api extends OAuth2Requester {
|
|
|
217
227
|
url: this.baseUrl + this.URLs.contacts,
|
|
218
228
|
query: {
|
|
219
229
|
limit,
|
|
220
|
-
after,
|
|
221
230
|
properties,
|
|
222
231
|
}
|
|
223
232
|
};
|
|
224
|
-
|
|
233
|
+
if (after) {
|
|
234
|
+
options.query.after = after;
|
|
235
|
+
}
|
|
225
236
|
return this._get(options);
|
|
226
237
|
}
|
|
227
238
|
|
package/defaultConfig.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"label": "HubSpot",
|
|
4
4
|
"productUrl": "https://hubspot.com",
|
|
5
5
|
"apiDocs": "https://developers.hubspot.com",
|
|
6
|
-
"logoUrl": "https://friggframework.org/assets/img/hubspot.jpeg",
|
|
6
|
+
"logoUrl": "https://friggframework.org/assets/img/hubspot-icon.jpeg",
|
|
7
7
|
"categories": [
|
|
8
8
|
"Marketing",
|
|
9
9
|
"Sales",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/api-module-hubspot",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8-canary.88be3bc.0",
|
|
4
4
|
"prettier": "@friggframework/prettier-config",
|
|
5
5
|
"description": "HubSpot API module that lets the Frigg Framework interact with HubSpot",
|
|
6
6
|
"main": "index.js",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"author": "",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@friggframework/devtools": "^1.1.
|
|
15
|
-
"@friggframework/test": "^1.1.
|
|
14
|
+
"@friggframework/devtools": "^1.1.8",
|
|
15
|
+
"@friggframework/test": "^1.1.8",
|
|
16
16
|
"dotenv": "^16.0.3",
|
|
17
17
|
"eslint": "^8.22.0",
|
|
18
18
|
"jest": "^28.1.3",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"prettier": "^2.7.1"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@friggframework/core": "^1.1.
|
|
23
|
+
"@friggframework/core": "^1.1.8",
|
|
24
|
+
"avid-reader": "^0.1.1"
|
|
24
25
|
},
|
|
25
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "88be3bc61aad168e615780d3dc6185cbe03aace3"
|
|
26
27
|
}
|
package/tests/api.test.js
CHANGED
|
@@ -67,24 +67,28 @@ describe(`${config.label} API tests`, () => {
|
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
// Skipping tests... inherited with bugs, needs refactor
|
|
70
|
-
describe.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const response = await api.getDealById(deal_id);
|
|
74
|
-
expect(response.id).toBe(deal_id);
|
|
75
|
-
expect(response.properties.amount).to.eq('100000');
|
|
76
|
-
expect(response.properties.dealname).to.eq('Test');
|
|
77
|
-
expect(response.properties.dealstage).to.eq('appointmentscheduled');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('should return all deals of a company', async () => {
|
|
70
|
+
describe.only('HS Deals', () => {
|
|
71
|
+
let deal_id;
|
|
72
|
+
it('should return a page of deals', async () => {
|
|
81
73
|
let response = await api.listDeals();
|
|
74
|
+
expect(response.results).toHaveProperty('length');
|
|
82
75
|
expect(response.results[0]).toHaveProperty('id');
|
|
76
|
+
deal_id = response.results[0].id;
|
|
83
77
|
expect(response.results[0]).toHaveProperty('properties');
|
|
84
78
|
expect(response.results[0].properties).toHaveProperty('amount');
|
|
85
79
|
expect(response.results[0].properties).toHaveProperty('dealname');
|
|
86
80
|
expect(response.results[0].properties).toHaveProperty('dealstage');
|
|
87
81
|
});
|
|
82
|
+
it('should return a deal by id', async () => {
|
|
83
|
+
const response = await api.getDealById(deal_id);
|
|
84
|
+
expect(response.id).toBe(deal_id);
|
|
85
|
+
});
|
|
86
|
+
it('should return all deals using paginator', async () => {
|
|
87
|
+
const results = await api.paginator.fetchAllPages(api.listDeals);
|
|
88
|
+
expect(results).toHaveProperty('length');
|
|
89
|
+
expect(results.length).toBeGreaterThan(100);
|
|
90
|
+
})
|
|
91
|
+
|
|
88
92
|
});
|
|
89
93
|
|
|
90
94
|
// Some tests skipped ... inherited with bugs, needs refactor
|
|
@@ -227,7 +231,7 @@ describe(`${config.label} API tests`, () => {
|
|
|
227
231
|
});
|
|
228
232
|
|
|
229
233
|
// Some tests skipped ... inherited with bugs, needs refactor
|
|
230
|
-
describe('HS Contacts', () => {
|
|
234
|
+
describe.only('HS Contacts', () => {
|
|
231
235
|
let createResponse;
|
|
232
236
|
|
|
233
237
|
it('should create a Contact', async () => {
|
|
@@ -266,6 +270,12 @@ describe(`${config.label} API tests`, () => {
|
|
|
266
270
|
let response = await api.archiveContact(createResponse.id);
|
|
267
271
|
expect(response.status).toBe(204);
|
|
268
272
|
});
|
|
273
|
+
|
|
274
|
+
it('should page all contacts using paginator', async () => {
|
|
275
|
+
const results = await api.paginator.fetchAllPages(api.listContacts);
|
|
276
|
+
expect(results).toHaveProperty('length');
|
|
277
|
+
expect(results.length).toBeGreaterThan(100);
|
|
278
|
+
});
|
|
269
279
|
});
|
|
270
280
|
|
|
271
281
|
// Skipping tests... inherited with bugs, needs refactor
|