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;
}