Skip to content

Commit 1f6b085

Browse files
committed
feat: factor in get businesses endpoint and reflect on readme
1 parent 70f9573 commit 1f6b085

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ let user = thepeer.indexUser("Thor Odin", "thor", "[email protected]");
5656
- link_id (string)
5757
- amount (integer)
5858
- `returns`: object
59+
* getBusinesses
60+
- `accepts`:
61+
- channel (string)
62+
- `returns`: object
5963

6064
## Extra
6165

lib/Thepeer.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,25 @@ class Thepeer {
157157
Helper.processError(e)
158158
}
159159
}
160+
161+
/**
162+
* Get a list of all integrated businesses and their respective images
163+
* @param {string} channel - Channel type (send, checkout, direct_charge)
164+
* @returns {JSON} A JSON response containing the details of the businesses
165+
* @memberof Thepeer
166+
*/
167+
async getBusinesses (channel) {
168+
try {
169+
let url = '/businesses'
170+
if (channel.length !== 0) {
171+
url += `?channel=${channel}`
172+
}
173+
const response = await this.request.get(url)
174+
return response.data
175+
} catch (e) {
176+
Helper.processError(e)
177+
}
178+
}
160179
}
161180

162181
module.exports = Thepeer

0 commit comments

Comments
 (0)