|
| 1 | +//This file provides a few different examples of how the SDK can be used to interact with private CrowdHandler API methods |
| 2 | +//To understand the required parameters, request methods and expected responses, please refer to the full API documentation |
| 3 | +//API documentation can be found in the CrowdHandler control panel Under "Account -> API" |
| 4 | + |
| 5 | +//Import the CrowdHandler SDK |
| 6 | +const crowdhandler = require("crowdhandler-sdk"); |
| 7 | + |
| 8 | +//Instantiate a new PrivateClient object |
| 9 | +let private_client = new crowdhandler.PrivateClient("YOUR_PRIVATE_KEY_HERE"); |
| 10 | + |
| 11 | +//Get a list of all domains associated with the key |
| 12 | +let domains = await private_client.domains().get(); |
| 13 | + |
| 14 | +//Fetch details for a specific domain |
| 15 | +let yourDomain = await private_client.domains().get("dom_4RQg2RBH7DLA"); |
| 16 | + |
| 17 | +//Update the rate of yourDomain |
| 18 | +await private_client.domains().put("dom_4RQg2RBH7DLA", { |
| 19 | + rate: 100, |
| 20 | +}); |
| 21 | + |
| 22 | +//Fetch a domains report |
| 23 | +//Parameters are passed as an object |
| 24 | +let domainsReport = await private_client.domainsReports().get("dom_4RQg2RBH7DLA", { |
| 25 | + from: "2023-06-06T19:59:00.000Z", |
| 26 | + to: "2023-07-06T19:59:00.000Z", |
| 27 | + day: "day", |
| 28 | +}); |
| 29 | + |
| 30 | +//Fetch waiting rooms associated with the key |
| 31 | +let rooms = await private_client.rooms().get(); |
| 32 | + |
| 33 | +//Fetch details for a specific room |
| 34 | +let yourRoom = await private_client.rooms().get("room_5SRg2RBH7DLA"); |
| 35 | + |
| 36 | +//Get a list of sessions associated with a room |
| 37 | +let roomSessions = await private_client.roomsSessions().get("room_5SRg2RBH7DLA"); |
| 38 | + |
| 39 | +//Delete a session |
| 40 | +await private_client.sessions().delete("ses_5SRg2RBH7DLA"); |
| 41 | + |
| 42 | + |
| 43 | + |
0 commit comments