A package for communicating with the S´banken API.
Make sure to create a .env
file at the root of the cloned repository. It should have the following fields:
USER_ID= CLIENT_ID= SECRET=
$ yarn install # Install dependencies
$ yarn start # Run index.mjs
Code found in index.mjs
aswell.
// Import as early as possible.
import dotenv from 'dotenv';
dotenv.config();
// Import desired functions
import {
getAccountDetails,
getAccountNumberDetails,
getAccountTransactions
} from './Api.mjs';
const main = async () => {
try {
const details = await getAccountDetails();
console.log('Retrieved details:\n', details);
const numberDetails = await getAccountNumberDetails('YourAccountId');
console.log('Retrieved number details:\n', numberDetails);
const transactions = await getAccountTransactions('YourAccountId');
console.log('Retrieved transactions:\n', transactions);
} catch (error) {
console.log(error);
}
};
main();