Builder
Builder Service
Description
- Builder is the only Visual Development Platform that offers an AI-powered design-to-code tool, a visual editor, and an enterprise CMS.
- Builder is a creational design pattern that lets you construct complex objects step by step. The pattern allows you to produce different types and representations of an object using the same construction code.
- Imagine a complex object that requires laborious, step-by-step initialization of many fields and nested objects. Such initialization code is usually buried inside a monstrous constructor with lots of parameters. Or even worse: scattered all over the client code.
Key Features
- Redis Caching: Avoids redundant API calls by storing and retrieving data from cache.
- Centralized Error Handling: All errors routed through customClientErrorHandler.
- Flexible Models: Built to fetch various models (pages, blogs, menus, etc.) dynamically.
- Locale Support: Locale values included in all major fetch functions.
Utilities/Functions used
- These functions are designed to fetch various CMS-driven content (pages, blogs, menus, etc.) using the Builder.io SDK with Redis caching and centralized error handling.
getBuilderList(options, nuxtApp?)
- 🧱 Purpose: Fetches a list of entries (e.g. pages, blogs) from Builder.io with caching support.
- 📌 Parameters:
options (object): Includesmodel,query,sort,locale,limit,offset,apiKey.nuxtApp(optional): Used to access$redisforcaching.
- ⚙️ Behavior:
- Attempts to return data from Redis cache first.
- Falls back to Builder.io
fetchEntries()if cache miss. - Sets Redis cache with 1-hour expiry.
- Logs and rethrows errors via
customClientErrorHandler.
getPageContent(urlPath, locale, apiKey, nuxtApp?)
- 🧱 Purpose: Fetches content of a single page based on URL path.
- 📌 Parameters:
urlPath (String): Path to the page (e.g./about).locale (String): Locale value (default'nl-NL').apiKey (String): Builder API key.nuxtApp (optional): For Redis caching.
- ⚙️ Behavior:
- Uses
fetchOneEntry()to retrieve a single page. - Caches response using
nuxtApp.$redis. - Normalizes locale: uses
"Default"for'nl-NL'. - Handles and logs critical errors.
- Uses
getPopularKeywords(apiKey, nuxtApp?)
- 🧱 Purpose: Fetches popular keywords stored in the CMS.
- 📌 Parameters:
apiKey (String): Builder API key.nuxtApp (optional): For Redis Cache.
- ⚙️ Behavior:
- Uses getBuilderList() to fetch keyword data.
- Extracts
keywordfrom responseitem.data.keyword. - Returns an array of keyword objects.
- Utilizes Redis cache with 1-hour expiry.
getHeaderMenu(locale, apiKey, nuxtApp?)
- 🧱 Purpose: Fetches header navigation links.
- 📌 Parameters:
locale (String): Locale Settings.apiKey (String): Builder API key.nuxtApp (Optional): For caching support.
- ⚙️ Behaviour:
- Fetches data from the header-links model.
- Uses getBuilderList() internally.
- Error context is enriched with builderError: true.
getBlogList(apiKey, opts, nuxtApp?)
- 🧱 Purpose: Retrieves a list of blog entries.
- 📌 Parameters:
apiKey (String): Builder API key.opts (object): Additional options to customize query.nuxtApp (Optional): For Redis cache.
- ⚙️ Behaviour:
- Builds options with a limit of 100.
- Fetches blog entries via fetchEntries().
- Uses caching and centralized error handling.
getFooterLinks(apiKey, opts, nuxtApp?)
- 🧱 Purpose: Retrieves footer navigation links from the CMS.
- 📌 Parameters:
apiKey (String): Builder API key.opts (object): Additional query/customization options.nuxtApp (Optional): Enables caching via Redis.
- ⚙️ Behaviour:
- Uses the
footer-linksmodel. - Delegates fetching to
getBuilderList()with error metadata.
- Uses the
getProCardPopUpConsentData(apiKey, opts, nuxtApp?)
- 🧱 Purpose: Retrieves consent data related to "Pro Card" T&Cs.
- 📌 Parameters:
apiKey (String): Builder API key.opts (object): Extra filter/sort options.nuxtApp (Optional): For caching support.
- ⚙️ Behaviour:
- Fetches from
pro-card-terms-and-conditionmodel. - Applies Redis caching and logs errors with metadata.
- Uses
getBuilderList()for data retrieval.
- Fetches from