npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');
const sdk = new SuperfaceClient();
async function run() {
// Load the profile
const profile = await sdk.getProfile('fetch-current-comic@0.0.0');
// Use the profile
const result = await profile
.getUseCase('FetchCurrentComic')
.perform({}, {
provider: 'xkcd',
mapVariant: 'generated'
});
// Handle the result
try {
const data = result.unwrap();
console.log(data);
} catch (error) {
console.error(error);
}
}
run();
{
"alt": "",
"day": "",
"img": "",
"link": "",
"month": "",
"news": "",
"num": 42,
"safeTitle": "",
"title": "",
"transcript": "",
"year": ""
}