Change Endpoints Used In API Calls
Services which interact with Klevu's APIs use a common class to provide endpoint URLs for requests. In the majority of cases, the domains provided will the ones needed to send or receive data. The primary exception is when sending search requests (including for Smart Category Merchandising) where the search URL varies by account. Note: at time of writing, no SDK servies interact with search URLs
The BaseUrlsProvider class allows updating base URLs from an Account object (see Examples > How To > Account Management > Retrieve Klevu Account Details) either via the constructor or after instantiation.
An example use case would be to load and cache Klevu account information locally, which can be used to create Account objects (via the AccountFactory) for subsequent requests, rather than sending API requests on each page load.
The BaseUrlsProvider instance can then be used by any service that interacts with Klevu, all of which accept a BaseLoggerInterface instance via their constructor.
Note: if you are integrating into a modern framework, you should implement this via your dependency injection system.