0.1.3 • Published 10 months ago

@candioto/nestjs-hubspot v0.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Unofficial Hubspot NestJS module

❗Module and documentation under development.

A simple NestJS module inspired by Olivier Maréchal's module that provides Hubspot official client to NestJS applications.

Comming soon...

Instalation

npm install --save @candioto/nestjs-hubspot @hubspot/api-client

Getting Started

The simplest way to use @candioto/nestjs-hubspot is to use HubspotModule.forRoot

import { Module } from '@nestjs/common';
import { HubspotModule } from '@candioto/nestjs-hubspot';

@Module({
  imports: [
    HubspotModule.forRoot({
      apiKey: 'my_secret_key', // it accepts all the same parameters as the official client
    }),
  ],
})
export class AppModule {}

You can then inject the Hubspot client into any of your injectables by using a custom decorator

import { Injectable } from '@nestjs/common';
import { InjectHubspot } from '@candioto/nestjs-hubspot';
import { Client } from '@hubspot/api-client';

@Injectable()
export class AppService {
  public constructor(
    @InjectHubspot() private readonly hubspotClient: Client,
  ) {}
}

Asynchronous setup is also supported

import { Module } from '@nestjs/common';
import { HubspotModule } from '@candioto/nestjs-hubspot';

@Module({
  imports: [
    HubspotModule.forRootAsync({
      // inject: [ConfigService], with configService
      useFactory: (/* configService: ConfigService */) => ({
        apiKey: process.env.API_KEY, // configService.get('hubspot_api_key'),
      }),
    }),
  ],
})
export class AppModule {}

See the official docs of the client at https://github.com/HubSpot/hubspot-api-nodejs/tree/master

Author

Contributing

I would greatly appreciate any contributions to make this project better. Please make sure to follow the below guidelines before getting your hands dirty.

  1. Fork the repository
  2. Create your branch (git checkout -b my-branch)
  3. Commit any changes to your branch
  4. Push your changes to your remote branch
  5. Open a pull request

License

Distributed under the MIT License. See LICENSE for more information. -->

Acknowledgements

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago