Skip to content

Commit

Permalink
Changelog And Readme Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
divyanshusinghh committed Nov 20, 2024
1 parent 35284b8 commit e4de87c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [v0.7.12] - 2024-11-18
### Changed
- Getting partner cient for offline token support added.
- Added offline token support for partner clients.

## [v0.7.11] - 2024-09-23
### Changed
Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,31 @@ function backgroundHandler(companyId) {
}
```


#### How to call partner apis in background tasks?

Background tasks running under some consumer or webhook or under any queue can get partner client via method `getPartnerClient`. It will return instance of `PartnerClient` as well.

> Here FdkClient `access_mode` should be **offline**. Cause such client can only access PartnerClient in background task.
```javascript
function backgroundHandler(organizationId) {
try {
const partnerClient = await fdkExtension.getPartnerClient(organizationId);
let data = await partnerClient.webhook.responseTimeSummary({
extensionId: '<EXTENSION_ID>',
startDate: '<START_DATE>',
endDate: '<END_DATE>'
});
// Some business logic here
res.json({ success: true });
} catch (err) {
console.error(err);
res.status(404).json({ success: false });
}
}
```

#### How to call partner apis?

To call partner api you need to have instance of `PartnerClient`. Instance holds methods for SDK classes. All routes registered under `partnerApiRoutes` express router will have `partnerClient` under request object which is instance of `PartnerClient`.
Expand Down

0 comments on commit e4de87c

Please sign in to comment.