Conversation
- Added `resolveApiUrl` helper to handle default API URL resolution and normalization. - Updated `SimFaceConfig` to make `apiUrl` optional. - Refactored `SimFaceAPIClient` to use `resolveApiUrl`. - Enhanced tests to validate default API URL behavior and trailing slash handling. - Updated documentation, examples, and types to reflect the new `apiUrl` feature.
There was a problem hiding this comment.
Pull request overview
Adds a default SimFace backend URL so SDK consumers can omit apiUrl from SimFaceConfig, simplifying integration while keeping the option to override the backend.
Changes:
- Make
SimFaceConfig.apiUrloptional and default it at runtime when constructingSimFaceAPIClient. - Introduce
resolveApiUrl()+DEFAULT_SIMFACE_API_URLhelper for consistent base-URL normalization. - Update tests and docs to reflect the optional
apiUrland the new default behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/index.ts | Makes apiUrl optional in the public config type. |
| src/shared/api-url.ts | Adds default backend URL constant and URL normalization helper. |
| src/services/api-client.ts | Uses resolveApiUrl() in the API client constructor. |
| src/services/api-client.test.ts | Adds URL-handling tests for omitted/blank apiUrl. |
| src/index.ts | Updates usage docs to omit apiUrl in the quick example. |
| src/index.test.ts | Adjusts entrypoint test config to omit apiUrl and asserts constructor args. |
| README.md | Updates examples and API reference to mark apiUrl optional. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| return DEFAULT_SIMFACE_API_URL; | ||
| } | ||
|
|
||
| const normalizedApiUrl = apiUrl.trim().replace(/\/$/, ''); |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates the SimFace SDK configuration to make apiUrl optional and defaults API calls to the hosted SimFace backend when no base URL is provided, simplifying consumer setup.
Changes:
- Make
SimFaceConfig.apiUrloptional and update docs/examples accordingly. - Add
resolveApiUrl()+DEFAULT_SIMFACE_API_URLhelper to centralize defaulting and normalization. - Update
SimFaceAPIClientand tests to support omitted/blankapiUrl.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/types/index.ts | Makes apiUrl optional in the public SDK config type. |
| src/shared/api-url.ts | Introduces default backend URL constant and URL resolution/normalization helper. |
| src/services/api-client.ts | Uses resolveApiUrl() in the API client constructor to safely default/normalize the base URL. |
| src/services/api-client.test.ts | Adds test coverage for missing/blank apiUrl defaulting behavior. |
| src/index.ts | Updates usage examples to omit apiUrl (now optional). |
| src/index.test.ts | Updates entrypoint tests to use config without apiUrl. |
| README.md | Updates documentation to reflect optional apiUrl and default behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| import { DEFAULT_SIMFACE_API_URL } from '../shared/api-url.js'; | ||
|
|
||
| const DEFAULT_API_URL = DEFAULT_SIMFACE_API_URL; |
No description provided.