Skip to content

Commit

Permalink
updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
Nataniel López committed Apr 12, 2022
1 parent abb351f commit 1543ab0
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ Receives the clientCodes from the API.

Parameters:
- clientCodes `string Array`: The client created codes.
- clients `object Array`: The clients created objects that were saved.

##### Example
```js
Expand All @@ -319,25 +320,30 @@ const { APICreate } = require('@janiscommerce/client-creator');

class ClientCreateAPI extends APICreate {

async postSaveHook(clientCodes) {
async postSaveHook(clientCodes, clients) {

await myPostSaveMethod(clientCodes);

clientCodes.forEach(clientCode => {
console.log(`Saved client ${clientCode}, now i'm gonna do something great`);
})

clients.forEach(({ databases, status }) => {
console.log(`This epic client has ${databases.length} databases and its status is ${status}`)
})
}
}

module.exports = ClientCreateAPI;
```

#### Listener Created
#### `postSaveHook(clientCode)`
#### `postSaveHook(clientCode, client)`
Receives the clientCode from the event.

Parameters:
- clientCode `string`: The client created code.gs of the created client.
- clientCode `string`: The client created code of the created client.
- client `object`: The client created object that was saved.

It can be implemented as the example bellow:
##### Example
Expand All @@ -348,8 +354,9 @@ const { ListenerCreated } = require('@janiscommerce/client-creator');

class ClientCreateListener extends ListenerCreated {

async postSaveHook(clientCode) {
async postSaveHook(clientCode, client) {
console.log(`Saved client ${clientCode}, now i'm gonna do something great`);
console.log(`Saved client has ${client.databases.length} databases! Whoaaa`)
}
}

Expand Down

0 comments on commit 1543ab0

Please sign in to comment.