List Conference Participants
You're ready for this how-to guide if you've got the following:
A FreeClimb account
A registered application
A configured FreeClimb Number
Your tools and language installed
Node.js
Using an instance of the FreeClimb SDK, an asynchronous request for all conference participants associated with a given ConferenceId
(not provided in the example) can be initiated. Additional filtering criteria such as Talk
and Listen
are possible if provided. Successful invocation of the get
method will return the participants which will allow for the sequential iteration through the entire list of conference participants.
Create your package.json file and save in the root directory of your project:
{
"name": "node-list-participants-how-to-guide",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"@freeclimb/sdk": "^3.8.0",
"dotenv": "^16.4.5"
}
}
Install the package by running the following in the command line/terminal:
yarn install
Example code:
require('dotenv').config()
const freeclimbSDK = require('@freeclimb/sdk')
// your freeclimb API key (available in the Dashboard) - be sure to set up environment variables to store these values
const accountId = process.env.ACCOUNT_ID
const apiKey = process.env.API_KEY
const conferenceId = process.env.CONFERENCE_ID
const configuration = freeclimbSDK.createConfiguration({ accountId, apiKey })
const freeclimb = new freeclimbSDK.DefaultApi(configuration)
// Invoke get participants method
getConferenceParticipants(conferenceId).then(participants => {
console.log('got all conference participants for', conferenceId)
console.log(participants)
// Use participants
}).catch(err => {
console.error(err)
// Catch Errors
})
async function getConferenceParticipants(conferenceId) {
// Create array to store all participants
const participants = []
// Invoke GET method to retrieve initial list of participant information
let response = await freeclimb.listParticipants(conferenceId);
participants.push(...response.participants)
while (response.nextPageUri) {
response = await freeclimb.getNextPage(response)
participants.push(...response.participants)
}
return participants
}
Java
Using a ParticipantsRequester
instance created from the ConferencesRequester
in the FreeClimbClient
, a synchronous request for all conference participants associated with a given ConferenceId
can be initiated. Additional filtering criteria such as Talk
and Listen
are possible if provided. Successful invocation of the get
method will return a ParticipantList
object which will allow for the sequential iteration through the entire list of conference participants.
Create your build.gradle file and save it to the root directory in your project:
/*
* This file was generated by the Gradle 'init' task.
*
* This is a general purpose Gradle build.
* Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds
*/
buildscript {
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
//Add the dependency
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:2.1.6.RELEASE"
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
bootJar {
baseName = 'gs-spring-boot'
version = '0.1.0'
}
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile "org.springframework.boot:spring-boot-starter-web"
testCompile "junit:junit"
compile 'com.github.FreeClimbAPI:FreeClimb-Java-SDK:3.0.0'
}
sourceSets {
main {
java {
srcDirs = ['src']
}
}
}
Build the file by running the following in your terminal/command line:
gradle build
Example code:
import com.vailsys.freeclimb.api.FreeClimbClient;
import com.vailsys.freeclimb.api.FreeClimbException;
import com.vailsys.freeclimb.api.conference.participant.Participant;
import com.vailsys.freeclimb.api.conference.participant.ParticipantList;
import com.vailsys.freeclimb.api.conference.participant.ParticipantsSearchFilters
import java.util.ArrayList;
public ArrayList listConferenceParticipants() {
ParticipantsSearchFilters filters = new ParticipantsSearchFilters();
filters.setTalk(true);
filters.setListen(true);
try {
// Create FreeClimbClient object
// accountId & apiKey can be found under API credentials on the FreeClimb Dashboard
FreeClimbClient client = new FreeClimbClient(accountId, apiKey);
//Invoke get method to retrieve initial list of conference participant information
ParticipantList participantList = client.conferences.getParticipantsRequester(conferenceId).get();
//Check if the list is empty by checking the total size
if(participantList.getTotalSize() > 0){
//retrieve all conference participant information from the server
while(participantList.getLocalSize() < participantList.getTotalSize()){
participantList.loadNextPage();
}
//Create a list of the conference participants
ArrayList<Participant> list = participantList.export();
// Loop through the list to process conference participant information
for(Participant participant : list){
//Do some processing
}
return list;
}
} catch(FreeClimbException ex){
//Exception throw upon failure
ex.printStackTrace();
}
return null;
}
C#
Using a ConferencesRequester
instance created from the getConferencesRequester
method in the FreeClimbClient
, a synchronous request for all conference participants associated with a given conferenceId
can be initiated. Filtering for criteria, such as Talk
and Listen
properties, is possible as shown in this how-to guide. Successful invocation of the get
method will return a ParticipantList
object which will allow for the sequential iteration through the entire list of conference participants. In this how-to guide we read through all pages of participants and place into one list that is returned.
The how-to guide is implemented in one method that returns a list of Participant instances for the conference whose conferenceId
is passed. This can be used in a web app, console app, etc.
Imports used:
using System;
using System.Collections.Generic;
using com.freeclimb.api;
using com.freeclimb.api.conference;
Example code:
public static IList<Participant> GetConferenceParticipantsList (string conferenceId) {
string acctId = getAcctId ();
string apiKey = getApiKey ();
IList<Participant> ret = new List<Participant> ();
FreeClimbClient client = new FreeClimbClient (acctId, apiKey);
// the last two parameters are to filter on the participants talk and listen properties respectively
ParticipantList participantList = client.getConferencesRequester.getParticipants (conferenceId);
if (participantList.getTotalSize > 0) {
// Retrieve all pages of results
while (participantList.getLocalSize < participantList.getTotalSize) {
participantList.loadNextPage ();
}
foreach (IFreeClimbCommon item in participantList.export ()) {
Participant participant = item as Participant;
// do whatever you need to do with participant object which contains all the conference properties
ret.Add (participant);
}
}
return ret;
}
Updated 2 months ago