Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

HubModel

Access hubspot like an ORM. Full Typescript Support. Inspired by Prisma.io's API
Explore the docs »

· Report Bug · Request Feature · Ask a Question · Say Hello 👋

LinkedIn

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. FAQ
  5. Roadmap
  6. Contributing
  7. License
  8. Contact

About The Project

Goals of this library:

  • fully type safe access to hubspot REST API to access all types in hubspot like contacts, deals, and especially including custom types

  • code first approach to maintaining the types and property in hubspot. just like any standard ORM like prisma, you define all the types in code and then run a migration to update hubspot.

(back to top)

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Installation

Get a hubspot access token. Instructions here https://developers.hubspot.com/docs/api/private-apps.

Node

NPM:

$ npm install hubmodel

YARN:

$ yarn add hubmodel

PNPM:

$ pnpm add hubmodel

DENO

import {...} from "https://deno.land/x/hubmodel/mod.ts"

(back to top)

Usage

For more examples, please refer to the Documentation

fetching

### fetching

// retreive all contacts and all their properties
await client.contacts.findMany({});

// retrieve all contacts but only include the 3 properties
await client.contacts.findMany({
  select: {
    address: true,
    hs_createdate: true,
    email: true,
    firstname: true,
  },
});

creating

deleting

(back to top)

FAQ

Why create your own client instead of fixing the types of the existing hubspot client?

Fixing existing hubspot client types was originally the approach but i had some issues with its API design, so felt i could kill 2 birds with 1 stone by diverging from the original client.

What should i do if this hubspot client is missing a hubspot endpoint?

Depends. Hubspot client has a lot of endpoints to cover, so instead of trying to replace all functionality, this library focuses on making the majority of the workflows intuitive with typescript and leaving the remaining workflows to the original hubspot client. If you need to use an endpoint that this library doesn't have, in the short term, I'd recommend using the hubspot client. In the long term, this library might want to support the endpoints so file a github ticket/discussion etc and we can discuss :)

Roadmap

  • Cli to generate bespoke hubspot model for the hubspot account
  • Query hubspot collections
  • specify fields to read on the collection using a select
  • filter which objects to retrieve from hubspot using a where
  • Select nested associated objects
  • collection pipelines
  • retrieve a properties historical values
  • retrieve a collections activity
  • Create hubspot objects
  • Create associations between hubspot objects
  • Update an object's fields
  • Update an object's associations
  • ORM - ORM like functionality, defining your hubspot schema in code and then syncing it to hubspot directly just like you would for a database. Inspired by https://www.prisma.io/

See the open issues for a full list of known issues.

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Joseph Siddall - j.b.siddall@gmail.com

Github Link: https://github.com/jbsiddall/hubmodel Docs Link: https://hubmodel.dev/

(back to top)

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages