@laboratoria/hubspot
Advanced tools
Comparing version 0.7.1 to 1.0.0
28
index.js
@@ -21,8 +21,14 @@ import https from 'node:https'; | ||
export const createClient = (hapikey) => { | ||
export const createClient = (token) => { | ||
// HTTP Request | ||
const request = (url, opts = {}) => new Promise((resolve, reject) => { | ||
const { params, body, ...httpOptions } = opts; | ||
const qs = querystring.stringify({ ...params, hapikey }); | ||
const request = https.request(`${baseUrl}${url}?${qs}`, httpOptions); | ||
const qs = querystring.stringify({ ...params }); | ||
const request = https.request(`${baseUrl}${url}?${qs}`, { | ||
...httpOptions, | ||
headers: { | ||
'Authorization': `Bearer ${token}`, | ||
'Content-Type': 'application/json' | ||
} | ||
}); | ||
@@ -119,4 +125,8 @@ request.on('error', reject); | ||
archived: 'false', | ||
properties: props.join(','), | ||
associations: associations.join(','), | ||
...(!!props.length && { | ||
properties: props.join(','), | ||
}), | ||
...(!!associations.length && { | ||
associations: associations.join(','), | ||
}), | ||
} | ||
@@ -130,7 +140,5 @@ }, | ||
params: { | ||
...( | ||
!!props.length && { | ||
properties: props.join(','), | ||
} | ||
), | ||
...(!!props.length && { | ||
properties: props.join(','), | ||
}), | ||
...(!!associations.length && { | ||
@@ -137,0 +145,0 @@ associations: associations.join(','), |
{ | ||
"name": "@laboratoria/hubspot", | ||
"version": "0.7.1", | ||
"version": "1.0.0", | ||
"description": "Unofficial Hubspot Node.js client", | ||
@@ -19,6 +19,6 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@babel/core": "^7.19.0", | ||
"@babel/preset-env": "^7.19.0", | ||
"babel-jest": "^29.0.2", | ||
"jest": "^29.0.2" | ||
"@babel/core": "^7.20.5", | ||
"@babel/preset-env": "^7.20.2", | ||
"babel-jest": "^29.3.1", | ||
"jest": "^29.3.1" | ||
}, | ||
@@ -25,0 +25,0 @@ "engines": { |
@@ -20,3 +20,3 @@ # Unofficial Hubspot Node.js client | ||
const hubspot = createHubSpotClient('<YOUR-HUBSPOT-API-TOKEN>'); | ||
const hubspot = createHubSpotClient('<YOUR-HUBSPOT-PRIVATE-APP-TOKEN>'); | ||
``` | ||
@@ -23,0 +23,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
7035
1
3
169