@uin-federation/sdk
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

UIN Federation SDK

GitHub Actions Workflow Status NPM License NPM Version npm bundle size

This SDK connects to the UIN Federation API for getting or creating, revoke, generating batch for UIN from the API.

Installation

Package Manager

npm install @uin-federation/sdk

Example

import UINFederation from '@uin-federation/sdk'

// Initialize UINFederation
const baseUrl = 'https://example.com/api'
const clientId = 'your-client-id'
const clientSecret = 'your-client'

const federation = new UINFederation({
  baseUrl: 'https://api.example.com',
  clientId: 'client123',
  clientSecret: 'secret456',
})

// Example 1: Get or Create UIN
const citizenDatas = [
  {
    externalId: '123',
    firstname: 'John',
    lastname: 'Doe',
    dateOfBirth: '2000-01-01',
    birthCertificateId: 'BC123',
    motherName: 'Jane Doe',
  },
]

try {
  const res = await federation.uins.getOrCreate(citizenDatas)
  console.log('UIN Response:', res)
} catch (err) {
  console.log('Error creating or fetching UIN:', err.message)
}

// Example 2: Revoke a UIN
const uin = '1234567890'
try {
  const res = await federation.uins.revoke(uin)
  console.log('Revoke UIN Response:', res)
} catch (err) {
  console.log('Error revoking UIN:', err.message)
}

// Example 3: Generate UIN Batch
const count = 5
try {
  const res = await federation.uins.generateBatch(count)
  console.log('Generate UIN Batch Response:', res)
} catch (err) {
  console.log('Error generating UIN Batch:', err.message)
}

Package Sidebar

Install

npm i @uin-federation/sdk

Weekly Downloads

3

Version

0.1.4

License

Apache-2.0 license

Unpacked Size

80.5 kB

Total Files

28

Last publish

Collaborators

  • dimby.digital
  • andostronaut