Retrieve paginated list of channels, e.g. text channels in slack or discord
npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');
// You can manage tokens here: https://superface.ai/insights
const sdk = new SuperfaceClient({ sdkAuthToken: '<< Login to get your token >>' });
async function run() {
// Load the profile
const profile = await sdk.getProfile('chat/channels@1.0.2');
// Use the profile
const result = await profile
.getUseCase('GetChannels')
.perform({
visibility: 'public',
limit: 2
}, {
provider: 'mock'
});
// Handle the result
try {
const data = result.unwrap();
console.log(data);
} catch (error) {
console.error(error);
}
}
run();
{
"visibility": "public",
"limit": 2
}
{
"channels": [
{
"id": "1",
"createdAt": 1546167104000,
"name": "random",
"membersCount": 100
}
]
}