import StudyfetchSDK from '@studyfetch/sdk';
import fs from 'fs';
import https from 'https';
async function createAndCheckPdf() {
const client = new StudyfetchSDK({
apiKey: process.env.STUDYFETCH_API_KEY,
baseURL: 'https://studyfetchapi.com',
});
// 1. Create PDF presentation
const pdfResponse = await client.v1.pdfGenerator.create({
topic: 'Complete Biology Study Guide',
numberOfSlides: 15,
locale: 'en'
});
console.log('PDF created:', pdfResponse.presentation?._id);
console.log('Success:', pdfResponse.success);
// 2. Check the created presentation
if (pdfResponse.presentation) {
const pdf = await client.v1.pdfGenerator.getById({
id: pdfResponse.presentation._id
});
console.log('Presentation details:');
console.log('- Topic:', pdf.topic);
console.log('- Slides:', pdf.numberOfSlides);
console.log('- Locale:', pdf.locale);
}
}
createAndCheckPdf();