Node.js client for the Base API service, with it you can manage authentication, email sending, files and images of your application.
Add the dependency to your
yarn add base-api-io
npm install base-api-io --save
Sign up on www.base-api.io and create an application and copy its access token.
Require the package:const Client =
Create a client:client ="your_access_token"
All functions return promises so you can chain them or just
emails endpoint on the client you can send emails:
// Sending an emailemail =await clientemails
users endpoint on the client you can create / get or delete users:
// Listing usersusers = await clientusersusersitems // The array of usersusersmetadatacount //The metadata object containing the total count// Create a user with email / passworduser =await clientusers// Get a users details by the iduser =await clientusers// Update a users email / custom datauser =await clientusers// Delete a user by iduser =await clientusers
sessions endpoint on the client you can authenticate a user.
// Create a user with email / passworduser =await clientsessions
Forgot Password Flow
passwords endpoint on the client you can perform a forgot password flow.
// Create an forgot password token for the user with the given email address.token =clientpasswords// Using that token set a new password.user =clientpasswords
files endpoint on the client you can create / get / delete or download files:
// Listing filesfiles = await clientfilesfilesitems // The array of filesfilesmetadatacount //The metadata object containing the total count// Create a filefile =await clientfiles// Get a file by idfile =await clientfiles// Delete a file by idfile =await clientfiles// Get a download URL to the file by idurl =await clientfiles// Download the file by id into a Bufferbuffer =await clientfiles
images endpoint on the client you can create / get / delete or process images:
// Listing imagesimages = await clientimagesimagesitems // The array of imagesimagesmetadatacount //The metadata object containing the total count// Create an imageimage =await clientimages// Get a image by idimage =await clientimages// Delete a image by idimage =await clientimages// Get a link to a prcessed version (crop & resize) of the image by idurl =await clientimages
A project can have many mailing lists which can be managed from the interface.
mailingLists endpoint allows you to programatically subscribe / unsubscribe
emails to a mailing list and send emails to all subscribes using a single call.
// List mailing listslists = await clientmailingListslistsitems // The array of mailing listslistsmetadata // The metadata object containing the total count// Get a mailing list by idlist =await clientmailingLists// Subscribe an email to a mailing list.list =await clientmailingLists// Unsubscribe an email from a mailing list.list =await clientmailingLists// Get a public unsubscribe url for the given mailing list and email which// when click unsubscribes a user from the mailing list and redirects to the// unsubscribe_redirect_url of the list.url =clientmailingLists// Send the same email to all of the subscribersresults =await clientmailingLists
A project can have many forms and those form can have many submissions.
forms endpoint allows you to programatically create, submit and manage forms.
// List formsforms = await clientformsformsitems // The array of formsformsmetadata // The metadata object containing the total count// Create a formform =await clientforms// Get a formform =await clientforms// Delete a form (and it's submissions)form =await clientforms// Submit a formsubmission =await clientforms// List form submissionssubmissions = await clientformssubmissionsitems // The array of forms submissionssubmissionsmetadata // The metadata object containing the total count// Get a submissionsubmission =await clientforms// Update a submissionssubmission =await clientforms// Delete a submissionsubmission =await clientforms
This library uses Needle, you can run the CI tasks locally with
- Fork it (https://github.com/base-api-io/base-node/fork)
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create a new Pull Request
- Gusztav Szikszai - creator and maintainer