@snsw/biz-js-client
TypeScript icon, indicating that this package has built-in type declarations

0.6.1 • Public • Published

Installation

Yarn

yarn add @snsw/biz-js-client

Npm

npm install @snsw/biz-js-client

Integration

TypeScript

// Import the following 
import { SNSWBizClient, Environment } from '@snsw/biz-js-client'

const client = new SNSWBizClient({
    /**
     * Description: API environment to invoke. 
     * Accepted Values: DEV, SIT, PSM, PROD. 
     * Default Value: PROD
     * Optional
     */
    env: Environment.DEV, 
    /**
     * Description: Api key required to invoke the api 
     * Required
     */
    apiKey: apiKey,
    /**
     * Description: OAuth2 access token of the authenticated user. 
     * Optional (Alternatively, the OAuth2 should be available in the cookie with the cookie name specified in the tokenCookieName param.)
     */
    accessToken: accessToken 
    /**
     * Description: Token cookie name that holds the Oauth2 access token. 
     * Default Value: access_token
     * Optional Yes (Alternatively, if the cookie name is access_token)

     */
    tokenCookieName:  tokenCookieName
});

// Returns object of type BizCustomer
const bizCustomer = await client.GetBizProfile();

// Accessing name
console.log(bizCustomer.firstName)
console.log(bizCustomer.lastName)
// Email
console.log(bizCustomer.email)
// Contact
console.log(bizCustomer.businessAddress.addressLine)
// Address
console.log(bizCustomer.contactDetails.mobilePhone)

BizCustomer Object Reference

// BizCustomer Object
class BizCustomer
    firstName: string;
    lastName: string;
    email: string;
    phone: string;
    businessAddress: BusinessAddress;
    contactDetails: ContactDetails;
    businessName: string;
    dob: string;
    entityName: string;
    gender: string;
    industry: string;
    location: string;
    middleName: string;
    name: string;
    abn: string;
}

class ContactDetails {
    mobilePhone: string;
}

class BusinessAddress {
    addressLine: string;
    buildingNumber: string;
    country: string;
    formattedAddress: string;
    latitude: number;
    longitude: number;
    nswPointId: string;
    postcode: string;
    propertyName: string;
    state: string;
    streetName: string;
    streetNumber: string;
    streetType: string;
    suburb: string;
    unitNumber: string;
    validated: boolean;
}

Readme

Keywords

none

Package Sidebar

Install

npm i @snsw/biz-js-client

Weekly Downloads

1

Version

0.6.1

License

MIT

Unpacked Size

30.3 kB

Total Files

6

Last publish

Collaborators

  • service-jw
  • service-ea
  • liu.xin.snsw
  • momin.aitizaz.snsw
  • ejap
  • shaun.wen
  • ivar.volt.snsw
  • matthew.holmes.service.nsw.gov.au
  • sagar.bhandari.snsw