# bodhi-client

> client API authentication and connection

Latest version **1.0.6** (published 2022-06-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install bodhi-client
pnpm add bodhi-client
yarn add bodhi-client
bun add bodhi-client
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2022-06-21 |
| First published | 2022-03-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 127.6 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | Ibrahim Jabr |
| Maintainers | ibrahim12 |
| Keywords | client |

## Links

- npm: https://www.npmjs.com/package/bodhi-client
- Repository: https://github.com/Software-Development-LLC/bodhi-client
- Homepage: https://github.com/Software-Development-LLC/bodhi-client#readme
- Issues: https://github.com/Software-Development-LLC/bodhi-client/issues
- npm.io page: https://npm.io/package/bodhi-client

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^0.26.0
- [build-url](https://npm.io/package/build-url.md) ^6.0.1
- [jwt-decode](https://npm.io/package/jwt-decode.md) ^3.1.2

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2022-06-21
- 1.0.5 — 2022-03-10
- 1.0.4 — 2022-03-08
- 1.0.3 — 2022-03-08
- 1.0.2 — 2022-03-08
- 1.0.1 — 2022-03-08
- 1.0.0 — 2022-03-08

## README

# bodhi-client

## Installation
Install the package with:

```sh
npm install bodhi-client 
# or
yarn add bodhi-client 
```
</br>

## Usage

Import bodhiClient to your app:
```javascript
  const bodhiClient = require('bodhi-client') 
  ```

Initiate new instance of bodhiClient:
```javascript
let example = new bodhiClient({
 clientId: "loginClientId",
 url:  "https://example.com",
 apiUrl: "https://example1.com",
 apiVersion: "v1",
})
```

Login:
```javascript
// 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', 
})

```
</br>

## Domain usage (User and client method)
### List domains:
```javascript
// 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: 
```javascript
// return a domain that match's the id if exist
example.domain.get({id: 'String'}) 
```

</br>

## User usage (User and client method)
### List users:
```javascript
// 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: 
```javascript
// return a user that match's the id if exist
example.user.get({id: 'String'}) 
```
</br>

## Type usage (User and client method)
### List types:
```javascript
// 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: 
```javascript
// return a type that match's the id if exist
example.type.get({id: 'String'})
```
### Create types:
```javascript
// return the new type 
example.type.create({name:"String",parentType:"String"})
```
### Update types:
```javascript
// 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:
```javascript
// return empty object
example.type.delete({id:"String"}) 
```
</br>

## Partner usage (User and client method)
### List partners:
```javascript
// 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: 
```javascript
// return a partner that match's the id if exist
example.partner.get({id: 'String'}) 
```
</br>

## Permissions Usage (User and client method)
### List permissions: 
```javascript
// return all permissions
example.permissions.list() 
```
</br>

## Profile Usage (User methods)
### Get profile: 
```javascript
// return a profile that match's the id if exist
example.profile.get() 
```
### Update profile:
```javascript
// 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         |

---
_Source: https://npm.io/package/bodhi-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
