bloggrs-api-client
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

Bloggrs API Client

Node.js client for Bloggrs API

NPM Version Build Status

Table of content

Features

☑️ Includes 90% of the official Bloggrs API endpoints.
☑️ Promise-based! No ugly callbacks.
☑️ Fully typed! Both for query parameters and responses.
☑️ Inbuilt in-memory cache for rate-limit friendly usage.

Getting Started

Get your Bloggrs credentials

You will need to create a set of Bloggrs developer credentials from your Bloggrs Developer account.
If you don't have one already, apply for a developer account here.
It takes about 5 minutes.

Install

npm i bloggrs-api-client

Usage

import { BloggrsClient } from 'bloggrs-api-client';

const bloggrsClient = new BloggrsClient({
  apiKey: '<YOUR-BLOGGERS-API-KEY>',
  // coming soon
  // apiSecret: '<YOUR-BLOGGRS-API-SECRET>',
  // accessToken: '<YOUR-BLOGGRS-ACCESS-TOKEN>',
  // accessTokenSecret: '<YOUR-BLOGGRS-ACCESS-TOKEN-SECRET>',
});

// Search for a user
const data = await bloggrsClient.users.all({ where: { email: "example@domain.com" });

// Get user by id
const data = await bloggrsClient.users.getOne(1234);

// Get most recent 25 posts 
const data = await bloggrsClient.all({ page: 25, pageSize: 1 });

See all available methods here.

Configuration

bloggrs-api-client comes with an inbuilt in-memory cache.
The stale data is served by the cache-first principle.

You can configure the caching behavior upon instantiation of the client:

const bloggrsClient = new BloggrsClient({
  apiKey: '<YOUR-BLOGGRS-API-KEY>',
  // coming soon
  // apiSecret: '<YOUR-BLOGGRS-API-SECRET>',
  // accessToken: '<YOUR-BLOGGRS-ACCESS-TOKEN>',
  // accessTokenSecret: '<YOUR-BLOGGRS-ACCESS-TOKEN-SECRET>',
  // ttl: 120, // seconds. Defaults to 360
  // disableCache: true, // Disables the caching behavior. Defaults to 'false'
  // maxByteSize: 32000000, // Maximum (approximated) memory size for cache store. Defaults to 16000000.
});

License

This project is licensed under the MIT License

Get Help

Contribute

Issues

In the case of a bug report, bugfix or a suggestions, please feel very free to open an issue.

Pull request

Pull requests are always welcome, and I'll do my best to do reviews as fast as I can. Please refer to the contribution guide to see how to get started.

Dependencies (5)

Dev Dependencies (5)

Package Sidebar

Install

npm i bloggrs-api-client

Weekly Downloads

5

Version

0.1.5

License

MIT

Unpacked Size

198 kB

Total Files

86

Last publish

Collaborators

  • gjergjk71