open-banking-pfm-sdk
Version:
The Open Banking PFM SDK uses Client classes and with **Promises** to get responses from the Open Banking PFM API in an easier way and structured as data models.
61 lines (44 loc) • 1.24 kB
Markdown

This client contains the available actions related to users and onboarding.
```javascript
import { UsersClient } from 'open-banking-pfm-sdk';
//The constructor receives an api key to validate access to all of its functions. This parameter is required. If you want to change the API Server Url you can do it passing it as second parameter.
const SERVER_URL =
'http://tecbantest@ec2-3-21-18-54.us-east-2.compute.amazonaws.com:8081/api/v1/';
const usersClient = new UsersClient('XXXX-XXXX-XXXX', SERVER_URL);
```
Creates a user. Cpf are unique per client.
```javascript
const clientCpf = '76109277673';
usersClient
.create(clientCpf)
.then((data) => console.log(data))
.catch((error) => console.log(error));
```
Output:
```console
User {
userId: 876454399,
cpf: "76109277673"
},
```
Given a valid user ID, fetches the information of an user.
```javascript
usersClient
.get(userId)
.then((data) => console.log(data))
.catch((error) => console.log(error));
```
Output:
```console
UserDetail {
id: 2230303,
cpf: '27767376109'
dateCreated: '1646243107260',
},
```