bodhi-client
Installation
Install the package with:
npm install bodhi-client
# or
yarn add bodhi-client
Usage
Import bodhiClient to your app:
const bodhiClient = require('bodhi-client')
Initiate new instance of bodhiClient:
let example = new bodhiClient({
clientId: "loginClientId",
url: "https://example.com",
apiUrl: "https://example1.com",
apiVersion: "v1",
})
Login:
// login as user
example.auth.login({
type: 'user',
userName: 'example@gmail.com',
password: 'password',
});
// login as client
example.auth.login({
type: 'client',
userName: 'example',
password: 'loginClientIdSecret',
});
// login with token
example.auth.login({
type: 'login',
token: 'token',
})
Domain usage (User and client method)
List domains:
// get all domains
example.domain.list()
// return all domains that match all the filter attributes
example.domain.list({filter{any:any}})
Domains filter list: will return any domains that match all the filter attributes
Attribute | Type | Required |
---|---|---|
id |
String | No |
name |
String | No |
Get domains:
// return a domain that match's the id if exist
example.domain.get({id: 'String'})
User usage (User and client method)
List users:
// return all users
example.user.list()
// return all userss that match all the filter attributes
example.user.list({filter{any:any}})
Users filter list: will return any users that match all the filter attributes
Attribute | Type | Required |
---|---|---|
id |
String | No |
name |
String | No |
firstName |
String | No |
lastName |
String | No |
email |
String | No |
firebaseId |
String | No |
keycloakId |
String | No |
partnerId |
String | No |
Get users:
// return a user that match's the id if exist
example.user.get({id: 'String'})
Type usage (User and client method)
List types:
// return all types that match all the filter attributes
example.type.list({filter{any:any}})
Types filter list: will return any types that match all the filter attributes
Attribute | Type | Required |
---|---|---|
id |
String | No |
name |
String | No |
parentType |
String | Yes |
Get types:
// return a type that match's the id if exist
example.type.get({id: 'String'})
Create types:
// return the new type
example.type.create({name:"String",parentType:"String"})
Update types:
// return the new type
example.type.update({id:"String",parentType:"String"})
Types update data list:
Attribute | Type | Required |
---|---|---|
name |
String | No |
parentType |
String | no |
Delete types:
// return empty object
example.type.delete({id:"String"})
Partner usage (User and client method)
List partners:
// return all partners
example.partner.list()
// return all partners that match all the filter attributes
example.partner.list({filter{any:any}})
Partners filter list: will return any partners that match all the filter attributes
Attribute | Type | Required |
---|---|---|
id |
String | No |
name |
String | No |
typeId |
String | No |
logoUrl |
String | No |
Get partners:
// return a partner that match's the id if exist
example.partner.get({id: 'String'})
Permissions Usage (User and client method)
List permissions:
// return all permissions
example.permissions.list()
Profile Usage (User methods)
Get profile:
// return a profile that match's the id if exist
example.profile.get()
Update profile:
// will update your partner
example.partner.update({any:any})
Profile parameters list: will return any profile that match all the filter attributes
Attribute | Type | Required |
---|---|---|
name |
String | No |
phone |
String | No |
email |
String | No |
partnerId |
String | No |
preferences |
Object | No |
Preferences list:
Attribute | Type | Required |
---|---|---|
defaultDomainId |
String | No |
defaultLanguage |
String | No |
defaultApplication |
String | No |
notificationsEmail |
Boolean | No |
notificationsSms |
Boolean | No |