New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@hubspot/api-client

Package Overview
Dependencies
Maintainers
14
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hubspot/api-client - npm Package Compare versions

Comparing version 3.2.3 to 3.2.4

16

CHANGELOG.md

@@ -124,4 +124,16 @@ # Changelog

## [3.2.0] - 2021-01-26
[unreleased]: https://github.com/HubSpot/hubspot-api-nodejs/compare/v3.1.0...HEAD
### Added
- automation.actions client
## [3.2.1] - 2021-01-26
### Fixed
- fix batch methods in `cms.blogs` API clients
[unreleased]: https://github.com/HubSpot/hubspot-api-nodejs/compare/v3.2.1...HEAD
[1.0.0-beta]: https://github.com/HubSpot/hubspot-api-nodejs/releases/tag/v1.0.0-beta

@@ -135,1 +147,3 @@ [1.1.0-beta]: https://github.com/HubSpot/hubspot-api-nodejs/releases/tag/v1.1.0-beta

[3.1.0]: https://github.com/HubSpot/hubspot-api-nodejs/releases/tag/v3.1.0
[3.2.0]: https://github.com/HubSpot/hubspot-api-nodejs/releases/tag/v3.2.0
[3.2.1]: https://github.com/HubSpot/hubspot-api-nodejs/releases/tag/v3.2.1

2

lib/package.json
{
"name": "@hubspot/api-client",
"version": "3.2.2",
"version": "3.2.4",
"description": "NodeJS v3 [HubSpot API](https://developers.hubspot.com/docs/api/overview) SDK(Client) files and sample apps",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

{
"name": "@hubspot/api-client",
"version": "3.2.3",
"version": "3.2.4",
"description": "NodeJS v3 [HubSpot API](https://developers.hubspot.com/docs/api/overview) SDK(Client) files and sample apps",

@@ -8,11 +8,8 @@ "main": "lib/index.js",

"scripts": {
"test": "echo \"No test specified\"",
"build": "tsc",
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
"lint": "tslint -p tsconfig.json -e codegen",
"prepare": "npm run build",
"prepublishOnly": "npm run lint",
"preversion": "npm run lint",
"version": "npm run format && git add -A src",
"postversion": "git push && git push --tags"
"test": "ts-node node_modules/jasmine/bin/jasmine --config=jasmine.json",
"prettier:check": "prettier --check {,**/}*.{js,ts}",
"prettier:write": "prettier --write {,**/}*.{js,ts}",
"lint": "tslint -p tsconfig.json && npm run prettier:check",
"prepare": "npm run build"
},

@@ -29,2 +26,3 @@ "author": "HubSpot",

"@types/bluebird": "^3.5.29",
"@types/jasmine": "^3.6.2",
"@types/lodash": "^4.14.149",

@@ -42,3 +40,5 @@ "@types/node": "^12.12.21",

"eslint-plugin-standard": "4.0.1",
"jasmine": "^3.6.3",
"prettier": "^1.19.1",
"ts-node": "^9.1.1",
"tslint": "^5.20.1",

@@ -45,0 +45,0 @@ "tslint-config-prettier": "^1.18.0",

# hubspot-api-nodejs
NodeJS v3 [HubSpot API](https://developers.hubspot.com/docs/api/overview) SDK(Client) files and sample apps

@@ -16,3 +17,3 @@

const hubspot = require('@hubspot/api-client')
const hubspotClient = new hubspot.Client({ apiKey: YOUR_API_KEY})
const hubspotClient = new hubspot.Client({ apiKey: YOUR_API_KEY })
```

@@ -49,3 +50,6 @@

```javascript
const hubspotClient = new hubspot.Client({ accessToken: YOUR_ACCESS_TOKEN, defaultHeaders: { "My-header": "test-example" } })
const hubspotClient = new hubspot.Client({
accessToken: YOUR_ACCESS_TOKEN,
defaultHeaders: { 'My-header': 'test-example' },
})
```

@@ -57,14 +61,8 @@

```javascript
const hubspotClient = new hubspot.Client();
return hubspotClient.oauth.defaultApi.createToken(
'refresh_token',
undefined,
undefined,
YOUR_CLIENT_ID,
YOUR_CLIENT_SECRET,
YOUR_REFRESH_TOKEN
)
.then(results => {
console.log(results.body);
const hubspotClient = new hubspot.Client()
return hubspotClient.oauth.defaultApi
.createToken('refresh_token', undefined, undefined, YOUR_CLIENT_ID, YOUR_CLIENT_SECRET, YOUR_REFRESH_TOKEN)
.then((results) => {
console.log(results.body)
// this assigns the accessToken to the client, so your client is ready

@@ -102,8 +100,7 @@ // to use

It's possible to turn off rate limiting:
```javascript
const hubspotClient = new hubspot.Client({
accessToken: YOUR_ACCESS_TOKEN,
const hubspotClient = new hubspot.Client({
accessToken: YOUR_ACCESS_TOKEN,
useLimiter: false,

@@ -114,8 +111,8 @@ })

It's possible to turn on retry for failed requests with statuses 429 or 5xx. To turn on/off Configurable Retries use numberOfApiCallRetries option on Client instance creation.
numberOfApiCallRetries could be set to a numberfrom 0 - 6. If numberOfApiCallRetries is set to a number greater than 0 it means that if any API Call receives ISE5xx this call will be retried after a delay 200 * retryNumber ms and if 429 (Rate limit is exceeded) is returned for "TEN_SECONDLY_ROLLING" the call will be retried after a delay 10 sec. Number of retries will not exceed numberOfApiCallRetries value.
numberOfApiCallRetries could be set to a numberfrom 0 - 6. If numberOfApiCallRetries is set to a number greater than 0 it means that if any API Call receives ISE5xx this call will be retried after a delay 200 \* retryNumber ms and if 429 (Rate limit is exceeded) is returned for "TEN_SECONDLY_ROLLING" the call will be retried after a delay 10 sec. Number of retries will not exceed numberOfApiCallRetries value.
```javascript
const hubspotClient = new hubspot.Client({
accessToken: YOUR_ACCESS_TOKEN,
numberOfApiCallRetries : NumberOfRetries.Six
const hubspotClient = new hubspot.Client({
accessToken: YOUR_ACCESS_TOKEN,
numberOfApiCallRetries: NumberOfRetries.Six,
})

@@ -127,5 +124,5 @@ ```

```javascript
const hubspotClient = new hubspot.Client({
accessToken: YOUR_ACCESS_TOKEN,
interceptors: [interceptorFn1, interceptorFn2]
const hubspotClient = new hubspot.Client({
accessToken: YOUR_ACCESS_TOKEN,
interceptors: [interceptorFn1, interceptorFn2],
})

@@ -139,9 +136,10 @@ ```

```javascript
hubspotClient.crm.contacts.basicApi.getPage(limit, after, properties, associations, archived)
.then(results => {
console.log(results.body)
})
.catch(err => {
console.error(err)
})
hubspotClient.crm.contacts.basicApi
.getPage(limit, after, properties, associations, archived)
.then((results) => {
console.log(results.body)
})
.catch((err) => {
console.error(err)
})
```

@@ -154,21 +152,46 @@

```javascript
const contactObj = {
const contactObj = {
properties: {
firstname: yourValue,
lastname: yourValue
}
};
lastname: yourValue,
},
}
const companyObj = {
properties: {
domain: yourValue,
name: yourValue
}
};
name: yourValue,
},
}
const hubspotClient = new hubspot.Client({ apiKey: YOUR_API_KEY });
const hubspotClient = new hubspot.Client({ apiKey: YOUR_API_KEY })
const createContactResponse = await hubspotClient.crm.contacts.basicApi.create(contactObj)
const createCompanyResponse = await hubspotClient.crm.companies.basicApi.create(companyObj)
await hubspotClient.crm.companies.associationsApi.create(createCompanyResponse.body.id, 'contacts', createContactResponse.body.id)
await hubspotClient.crm.companies.associationsApi.create(
createCompanyResponse.body.id,
'contacts',
createContactResponse.body.id,
)
```
### {EXAMPLE} Update multiple objects in batch mode
```javascript
const dealObj = {
id: yourId,
properties: {
amount: yourValue,
},
}
const dealObj2 = {
id: yourId,
properties: {
amount: yourValue,
},
}
const hubspotClient = new hubspot.Client({ apiKey: YOUR_API_KEY })
await hubspotClient.crm.deals.batchApi.update({ inputs: [dealObj, dealObj2] })
```
### {EXAMPLE} Import Contacts:

@@ -180,5 +203,5 @@

const hubspot = require('@hubspot/api-client')
const fs = require('fs');
const fs = require('fs')
const hubspotClient = new hubspot.Client({ apiKey: YOUR_API_KEY });
const hubspotClient = new hubspot.Client({ apiKey: YOUR_API_KEY })
const importRequest = {

@@ -218,5 +241,5 @@ name: 'test_import',

const hubspot = require('@hubspot/api-client')
const fs = require('fs');
const fs = require('fs')
const hubspotClient = new hubspot.Client({ apiKey: YOUR_API_KEY });
const hubspotClient = new hubspot.Client({ apiKey: YOUR_API_KEY })
const importRequest = {

@@ -277,3 +300,3 @@ name: 'test_import',

const filterGroup = { filters: [filter] }
const sort = JSON.stringify({ propertyName: 'createdate', direction: 'DESCENDING'})
const sort = JSON.stringify({ propertyName: 'createdate', direction: 'DESCENDING' })
const query = 'test'

@@ -290,4 +313,4 @@ const properties = ['createdate', 'firstname', 'lastname']

limit,
after
};
after,
}

@@ -347,6 +370,6 @@ const result = await hubspotClient.crm.contacts.searchApi.doSearch(publicObjectSearchRequest)

hubspotClient.apiRequest({
method: 'PUT',
path: '/some/api/not/wrapped/yet',
body: { key: 'value' },
})
method: 'PUT',
path: '/some/api/not/wrapped/yet',
body: { key: 'value' },
})
```

@@ -359,4 +382,4 @@

```typescript
import * as hubspot from '@hubspot/api-client';
const hubspotClient = new hubspot.Client({ apiKey: YOUR_API_KEY, developerApiKey: YOUR_DEVELOPER_API_KEY });
import * as hubspot from '@hubspot/api-client'
const hubspotClient = new hubspot.Client({ apiKey: YOUR_API_KEY, developerApiKey: YOUR_DEVELOPER_API_KEY })
```

@@ -366,2 +389,25 @@

MIT
Apache 2.0
## Contributing
Install project dependencies with
```bash
npm install
```
You can run the tests by executing:
```bash
npm run test
```
You can check the TypeScript code by running:
```
npm run lint
```
If there is a linting error based on formatting, you can run the command below to auto-correct the formatting:
```
npm run prettier:write
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc