const SibApiV3Sdk = require('@sendinblue/client');
require('dotenv').config();

async function main() {
  const apiInstance = new SibApiV3Sdk.SendersApi();
  apiInstance.setApiKey(
    SibApiV3Sdk.SendersApiApiKeys.apiKey,
    process.env.BREVO_API_KEY
  );

  try {
    console.log('Fetching senders...');
    const result = await apiInstance.getSenders();
    console.log('Verified Senders:', JSON.stringify(result.body, null, 2));

    const accountApi = new SibApiV3Sdk.AccountApi();
    accountApi.setApiKey(
      SibApiV3Sdk.AccountApiApiKeys.apiKey,
      process.env.BREVO_API_KEY
    );
    console.log('Fetching account info...');
    const accountInfo = await accountApi.getAccount();
    console.log('Account Info:', JSON.stringify(accountInfo.body, null, 2));
  } catch (err) {
    console.error('Error fetching from Brevo:', err);
  }
}

main();
