Have ideas to improve npm?Join in the discussion! »

grav.client
TypeScript icon, indicating that this package has built-in type declarations

2.4.20 • Public • Published

grav.client NodeJS SDK

A NodeJS SDK for the Gravatar XML-RPC API


Build Status Coverage Status GitHub tag (latest SemVer) license

NPM

If you are just getting started, be sure to see the Wiki and API docs.

Run in Postman

Installation

$  npm install grav.client

Tests

# unit tests
$ npm run test

# end-to-end tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

# acceptance tests
$ npm run test:spec

Usage

import { GravatarClient } from 'grav.client';

const client = new GravatarClient('user@example.com', 'password');

client.test().then(data => ... );

Methods

Method Description
client.exists() check if a primary image is set
client.addresses() list account email addresses
client.userImages() list account images
client.saveImage(imageFilePath) upload an image
client.saveEncodedImage(base64String) upload an encoded image
client.saveImageUrl(imageUrl) upload image from URL
client.useUserImage(imageName) update primary image
client.removeImage() remove primary image
client.deleteUserImage(imageName) delete an image
client.test() sanity check

Use Cases

grav.client ships with several use case classes that model different programming scenarios:

  • FindImageUseCase
  • GetPrimaryImageUseCase
  • LoadNextImageUseCase
  • LoadPreviousImageUseCase
  • SetNewImageUseCase
  • VerifyAccountUseCase

Example:

import { 
  GravatarClient,
  GetPrimaryImageUseCase
} from 'grav.client';

...

// create use case
const getPrimaryImageUseCase = new GetPrimaryImageUseCase();

// connect client
getPrimaryImageUseCase.client = new GravatarClient(email, password);

// let it rip
const primaryImage = await getPrimaryImageUseCase.execute();

License

MIT

Install

npm i grav.client

DownloadsWeekly Downloads

107

Version

2.4.20

License

MIT

Unpacked Size

322 kB

Total Files

201

Last publish

Collaborators

  • avatar