Skip to content

Default url#21

Merged
TristramN merged 3 commits intomainfrom
default-url
Mar 17, 2026
Merged

Default url#21
TristramN merged 3 commits intomainfrom
default-url

Conversation

@TristramN
Copy link
Copy Markdown
Contributor

No description provided.

- 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.
Copilot AI review requested due to automatic review settings March 17, 2026 09:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.apiUrl optional and default it at runtime when constructing SimFaceAPIClient.
  • Introduce resolveApiUrl() + DEFAULT_SIMFACE_API_URL helper for consistent base-URL normalization.
  • Update tests and docs to reflect the optional apiUrl and 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.

Comment thread src/services/api-client.test.ts Outdated
Comment thread src/shared/api-url.ts
return DEFAULT_SIMFACE_API_URL;
}

const normalizedApiUrl = apiUrl.trim().replace(/\/$/, '');
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 17, 2026 09:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.apiUrl optional and update docs/examples accordingly.
  • Add resolveApiUrl() + DEFAULT_SIMFACE_API_URL helper to centralize defaulting and normalization.
  • Update SimFaceAPIClient and tests to support omitted/blank apiUrl.

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.

Comment on lines +3 to +5
import { DEFAULT_SIMFACE_API_URL } from '../shared/api-url.js';

const DEFAULT_API_URL = DEFAULT_SIMFACE_API_URL;
@TristramN TristramN merged commit 14a15ba into main Mar 17, 2026
5 checks passed
@TristramN TristramN deleted the default-url branch March 17, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants