@youfibre/otsc
TypeScript icon, indicating that this package has built-in type declarations

2.0.29 • Public • Published

One-Touch Switching Client

Installation

npm install @youfibre/otsc

Basic Usage

// Add these imports...
import { OTSClient } from '@youfibre/otsc';

const client = new OTSClient(
  'https://hub-base-url',
  'https://sit-base-url',
  'my-client-id',
  'my-client-secret',
);

const clientWithCaching = new OTSClient(
  'https://hub-base-url',
  'https://sit-base-url',
  'my-client-id',
  'my-client-secret',
  {
    setItem: (key: string, value: string, ttlSeconds: number) => {
      // redisClient.set(key, value, 'EX', ttlSeconds);
    },
    getItem: (key: string) => {
      // return redisClient.get(key);
    }
  }
);

const message = {
  envelope: {
    source: {
      type: 'RCPID',
      identity: 'RCP001',
      correlationID: 'XYZ987'
    },
    destination: {
      type: 'RCPID',
      identity: 'RCP002',
      correlationID: 'XYZ123'
    },
    routingID: 'residentialSwitchMatchRequest'
  },

  residentialSwitchMatchRequest: {
    grcpBrandName: 'YouFibre Limited',
    name: 'Miggins', // Dummy data
    account: '0003316563216', // Dummy data
    address: {
      uprn: '12345', // Dummy data
      addressLines: ['Flat 1', 'Rose Cottage', '22 Cheshunt Mews', 'Cypress Street', 'Tyre Industrial Estate', 'Blnatyre'], // Dummy data
      postTown: 'Glasgow', // Dummy data
      postCode: 'SW1P 3UX' // Dummy data
    },
    services: [
      {
        serviceType: 'IAS',
        action: 'cease'
      },
      {
        serviceType: 'NBICS',
        serviceIdentifierType: 'DN',
        serviceIdentifier: '0101111222', // Dummy data
        action: 'port'
      }
    ]
  }
} as SwitchMessage;

const response = await client.postMessage(message);
console.log(response);

Package Sidebar

Install

npm i @youfibre/otsc

Weekly Downloads

15

Version

2.0.29

License

GPL-3.0

Unpacked Size

119 kB

Total Files

98

Last publish

Collaborators

  • yfsamuel