4.1.1 • Published 9 months ago

@whiterabbitjs/client v4.1.1

Weekly downloads
162
License
MIT
Repository
github
Last release
9 months ago

WhiteRabbit client

Simple frontend library to integrate WhiteRabbit on your streaming website.

Usage

Option 1. Install from npm

Install @whiterabbitjs/client package

npm install --save @whiterabbitjs/client

Then use it on your webpage

import { WhiteRabbitClient } from '@whiterabbitjs/client';

const client = new WhiteRabbitClient({ apiKey: '....your API key' });

client.requestPayment('tt8367814');

Option 2. Use as module

import { WhiteRabbitClient } from 'https://unpkg.com/@whiterabbitjs/client@2.40.1/dist/index.min.mjs';
const client = new WhiteRabbitClient({ apiKey: '....your API key' });

client.requestPayment('tt8367814');

API

new WhiteRabbitClient(whiterabbitConfig)

Create a new client instance.

Arguments:

  • whiteRabbitConfig — config object with attributes:

    • apiKey — API key of the partner. Could test or production one

client.requestPayment(imdbId, [pssAddress], [medium])

Request a payment by movie's imdb ID. Example: tt8367814. Returns a Promise which resolves with the status of the payment.

Arguments:

  • imdbId - imdb ID for the movie.

Response:

  • movieId — Number. Movie id as encoded by utils.imdbToToken function.
  • paymentId - String. Unique ID for the payment
  • status - Boolean. Result of the payment. true means the payment was successful, false — the payment was either declined by user or failure happened

Response example:

{
  movieId: "423557889"
  paymentId: "0x3202b4ef03ef29d87d81357e4c50105206be0396c5e5c4624d498b8cb7e2a083"
  status: true
}

Utils API

import { utils } from '@whiterabbitjs/client';

utils.imdbToToken(imdbId)

Convert given imdbId to WhiteRabbit token.

Arguments:

  • imdbId — imdbID for the Movie.

utils.tokenToImdb(tokenId)

Convert given WhiteRabbit tokenId to imdbId.

Arguments:

  • tokenId — tokenId for the MovieToken.

utils.getRegionByCode(regionCode)

Given a three digit M49 region code returns a two-letter ISO 3166-1 alpha-2 country code

Arguments:

  • regionCode — M49 region code. Three digits, zero-padded (e.g. 008).
4.0.1

9 months ago

4.0.0

9 months ago

4.1.0

9 months ago

4.1.1

9 months ago

2.38.0

2 years ago

3.1.0

2 years ago

3.5.0

1 year ago

2.40.5

2 years ago

2.40.4

2 years ago

2.40.1

2 years ago

2.40.11

2 years ago

2.40.12

2 years ago

2.40.10

2 years ago

2.40.13

2 years ago

2.40.9

2 years ago

2.40.14

2 years ago

2.40.8

2 years ago

3.4.0

2 years ago

3.0.2

2 years ago

3.0.7

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

3.0.0

2 years ago

3.3.1

2 years ago

3.3.0

2 years ago

3.3.4

2 years ago

2.39.1

2 years ago

2.39.0

2 years ago

2.39.3

2 years ago

2.39.2

2 years ago

2.34.0

2 years ago

2.36.0

2 years ago

2.31.0

3 years ago

2.35.0

2 years ago

2.37.0

2 years ago

2.26.2

3 years ago

2.26.1

3 years ago

2.26.0

3 years ago

2.24.0

3 years ago

2.20.4

3 years ago

2.19.0

3 years ago

2.18.0

3 years ago

2.17.0

3 years ago

2.16.1

3 years ago

2.16.0

3 years ago

2.15.3

3 years ago

2.14.1

3 years ago

2.14.0

3 years ago

2.11.0

3 years ago

2.13.0

3 years ago

2.12.0

3 years ago

2.10.0

3 years ago

2.9.0

3 years ago

2.4.0

3 years ago

2.6.0

3 years ago

2.8.0

3 years ago

2.3.0

3 years ago

2.5.0

3 years ago

2.7.0

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

1.40.0

3 years ago

2.0.0

3 years ago

1.37.0

3 years ago

1.39.0

3 years ago

1.38.0

3 years ago

1.36.0

3 years ago

1.35.0

3 years ago

1.34.0

3 years ago

1.32.0

3 years ago

1.33.0

3 years ago

1.29.1

3 years ago

1.30.0

3 years ago

1.31.0

3 years ago

1.29.0

3 years ago

1.28.0

3 years ago

1.27.0

3 years ago

1.25.0

3 years ago

1.26.0

3 years ago

1.24.0

3 years ago

1.23.0

3 years ago

1.22.0

3 years ago

1.21.0

3 years ago

1.20.0

3 years ago

1.19.0

3 years ago

1.18.0

3 years ago

1.17.0

3 years ago

1.16.0

3 years ago

1.9.0

3 years ago

1.8.0

3 years ago

1.7.3

4 years ago

1.7.2

4 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.5.2

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.15

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.8

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago