This is an unofficial TypeScript client for logging into and scraping BuildingLink content.
Install the package using your favorite package manager.
# Using npm
npm install buildinglink
This client is essentially a wrapper around the native fetch API, which does an auto-login as needed and stores session cookies for you.
import { BuildingLink } from "buildinglink";
const client = new BuildingLink({
username: "buildinglink_username",
password: "buildinglink_password",
});
// Get Deliveries
const url = "https://www.buildinglink.com/V2/Tenant/Deliveries/Deliveries.aspx";
const response = await client.fetch(url);
// Shorthand for tenant pages
const response = await client.page("Deliveries/Deliveries.aspx");
Module | Method | Description |
---|---|---|
Library | getLibrary() |
Access documents from the BuildingLink Library |
Announcements | getAnnouncements() |
Access announcements from the BuildingLink |
Events | getEvents(from: Date, to: Date) |
Access events from the BuildingLink Calendar |
Occupant | getOccupant() |
Access the current occupant's profile |
Buildings | getBuildings() |
Access buildings associated with the BuildingLink account |
User | getUser() |
Access the current user signed into BuildingLink |
Vendors | getVendors() |
Access preferred vendors from the BuildingLink |
Deliveries | getDeliveries() |
Access deliveries from the BuildingLink |
Since it's likely you'll be using this client for scraping, the response also includes a parsed version of the HTML document using node-html-parser
. You can access it on html responses from the document
property.
const { document } = await client.page("Deliveries/Deliveries.aspx");
document.querySelectorAll(".delivery-item").forEach((item) => {
const deliveryId = item.getAttribute("data-delivery-id");
const deliveryDate = item.querySelector(".delivery-date")?.textContent;
console.log(`Delivery ID: ${deliveryId}, Date: ${deliveryDate}`);
});
# Run tests
pnpm test
# Watch mode for development
pnpm test:watch
# Get that sweet, sweet coverage report
pnpm test:coverage
Found a bug? Want to add a feature? We'd love your help!
- Fork it
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazingness'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
MIT - Because sharing is caring! See LICENSE for more details.
If this package helped you automate your BuildingLink tasks, give it a star!
Made with ❤️ and ☕️ by a human who got tired of clicking through BuildingLink manually.