3.0.0 • Published 1 month ago

bima-shark-sdk v3.0.0

Weekly downloads
26
License
MIT
Repository
github
Last release
1 month ago

bima-shark-sdk (Javascript)

This is the Javascript SDK for the BImA applications.

Build Status

Installation

1) Install the npm package

npm install bima-shark-sdk

2) Bring your own fetch library.

3) In browser you have to use babel-loader to support IE 11 and project-wide babel.config.js. A .babelrc configuration is not enough and will ignore node_modules.

  // webpack.config.js
    module: {
      rules: [
        {
          test: /\.js$/,
          include: [
            path.resolve(__dirname, 'src'),
            path.resolve(__dirname, 'node_modules/bima-shark-sdk')
          ],
          use: {
            loader: 'babel-loader'
          }
        },
        ...

Usage

In browser

import Shark from 'bima-shark-sdk'

Shark.configure({
  debug: false,             // log request and response, when true
  secret: 'random-id',      // user specific secret e.g. id
  serviceTokenUrl: '/doorkeeper/service_token'
})

import { UserClient } from 'bima-shark-sdk'

const client = new UserClient('https://doorkeeper-development.bundesimmo.de')
client.find(123)
  .then(
    json => { console.log('Success: ', json) },
    err => { console.log('Error: ', err) }
  ).finally(
    () => { console.log('Hide loader') }
  )

In Node.js

const { MailingClient } = require('bima-shark-sdk')

const client = new MailingClient('https://mailing-development.bundesimmo.de', {
  serviceToken: {
    baseUrl: 'https://doorkeeper-development.bundesimmo.de',
    accessKey: 'your-access-key',
    secretKey: 'your-secret-key',
    userId: '1234567890'  // optional
  }
})

try {
  const json = await client.create({ foo: 'bar' })
  console.log('Success: ', json)
} catch (err) {
  console.log('Error: ', err)
}

Testing

This SDK uses jest as test framework. Server responses are mocked with nock.

npm ci
npm test

Links for further reading

3.0.0

1 month ago

2.14.0

3 months ago

2.13.0

2 years ago

2.13.1

2 years ago

2.12.1

3 years ago

2.12.0

3 years ago

2.11.0

3 years ago

2.10.0

3 years ago

2.9.0

4 years ago

2.8.0

4 years ago

2.7.1

4 years ago

2.7.0

4 years ago

2.6.0

4 years ago

2.5.0

4 years ago

2.4.0

4 years ago

2.3.0

4 years ago

2.2.0

4 years ago

2.1.1

4 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.15.0

5 years ago

0.15.0-pre2

6 years ago

0.15.0-pre1

6 years ago

0.14.0

6 years ago

0.13.1

6 years ago

0.13.0

6 years ago

0.12.0

6 years ago

0.11.1

6 years ago

0.11.0

6 years ago

0.10.0

6 years ago

0.9.0

6 years ago

0.8.0

6 years ago

0.7.0

6 years ago

0.7.0-pre5

6 years ago

0.7.0-pre4

6 years ago

0.7.0-pre2

6 years ago

0.7.0-pre

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago