Retrieve a paginated list of posts from a social media profile.
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('social-media/posts@1.0.1');
// Use the profile
const result = await profile
.getUseCase('GetProfilePosts')
.perform({
profileId: '',
beforeDate: '',
afterDate: '',
page: ''
}, {
provider: 'mock'
});
// Handle the result
try {
const data = result.unwrap();
console.log(data);
} catch (error) {
console.error(error);
}
}
run();
{
"profileId": "",
"beforeDate": "",
"afterDate": "",
"page": ""
}
{
"previousPage": "",
"nextPage": "",
"posts": [
{
"id": "",
"url": "",
"createdAt": "",
"text": "",
"attachments": [
{
"type": "",
"url": "",
"preview": "",
"title": "",
"description": "",
"altText": "",
"duration": 42,
"width": 42,
"height": 42
}
]
}
]
}