Simplify API client scoping#642
Merged
heyitsaamir merged 4 commits intoJul 14, 2026
Merged
Conversation
Remove per-call API client service URL and agentic identity overrides, add scoped API client cloning helpers, and update app sending to derive scoped clients from the base API client. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors how service URL and agentic identity scoping is applied across the SDK by removing per-request overrides in low-level API clients and introducing “scoped client” helpers (clone, fromServiceUrl, fromAgenticIdentity, forAgenticIdentity). It then updates app send/process flows and examples to derive correctly scoped API clients from a base client.
Changes:
- Remove per-call
serviceUrl/agenticIdentityrequest options from low-level API clients and normalizeserviceUrlat construction time. - Add scoped API client helpers to
@microsoft/teams.apiClientand update apps pipeline code to useClient.clone(...)-based scoping. - Update/expand unit tests and example code to reflect the new scoping model.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/apps/src/types/plugin/sender.ts | Replaces RequestOptions with ActivitySenderOptions to carry agentic identity only. |
| packages/apps/src/app.ts | Adds AppSendOptions and scopes outbound sending via ref serviceUrl + optional agentic identity. |
| packages/apps/src/app.process.ts | Uses api.clone({ serviceUrl, agenticIdentity }) for per-activity scoped API in processing. |
| packages/apps/src/app.process.spec.ts | Adds test ensuring incoming activity scopes the app API via clone. |
| packages/apps/src/activity-sender.ts | Switches sender to a scoped-client factory rather than per-call request options. |
| packages/apps/src/activity-sender.spec.ts | Updates tests to validate client factory usage and agentic identity scoping. |
| packages/api/src/clients/team.ts | Removes per-call overrides; normalizes constructor serviceUrl. |
| packages/api/src/clients/team.spec.ts | Updates expectations for removed options + serviceUrl normalization behavior. |
| packages/api/src/clients/service-url.ts | Introduces normalizeServiceUrl() helper. |
| packages/api/src/clients/request-options.ts | Deletes legacy request options helpers (serviceUrl/agentic identity per request). |
| packages/api/src/clients/reaction/reaction.ts | Removes request options; normalizes constructor serviceUrl. |
| packages/api/src/clients/reaction/reaction.spec.ts | Updates tests for new method signatures and normalization behavior. |
| packages/api/src/clients/meeting.ts | Removes request options; normalizes constructor serviceUrl. |
| packages/api/src/clients/meeting.spec.ts | Updates tests for new method signatures and normalization behavior. |
| packages/api/src/clients/index.ts | Adds clone/fromServiceUrl/fromAgenticIdentity and adjusts HTTP/auth interceptor handling. |
| packages/api/src/clients/index.spec.ts | Adds tests validating agentic identity and service-url scoped cloning behavior. |
| packages/api/src/clients/conversation/members.spec.ts | Updates expectations for removed request config argument usage. |
| packages/api/src/clients/conversation/member.ts | Removes request options; normalizes constructor serviceUrl. |
| packages/api/src/clients/conversation/index.ts | Removes request options, adds reaction support, and propagates http to sub-clients. |
| packages/api/src/clients/conversation/activity.ts | Removes request options; normalizes constructor serviceUrl. |
| packages/api/src/clients/conversation/activity.spec.ts | Updates expectations for new method signatures and normalization behavior. |
| packages/api/src/clients/auth-provider-interceptor.ts | Removes per-request agentic identity override; uses default agentic identity only. |
| packages/api/src/clients/auth-provider-interceptor.spec.ts | Updates tests to reflect default-only agentic identity behavior. |
| examples/agent365/src/proactive.ts | Updates example to use fromAgenticIdentity() scoped API client instead of per-call options. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use the scoped client factory as ActivitySender's sole client dependency instead of also accepting a base API client. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Make the top-level API Client http property read-only so scoped cloning cannot drift from a replaced HTTP client, and update tests to assert the public property is not settable. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
MehakBindra
approved these changes
Jul 14, 2026
Make undefined agentic identity clone options preserve the current default while null explicitly clears it, and document the new public API surfaces and agent guidance. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 319a7f22-0e26-468e-92ee-782918890c26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
clone,fromServiceUrl,fromAgenticIdentity,forAgenticIdentity)