Skip to content

Simplify API client scoping#642

Merged
heyitsaamir merged 4 commits into
agent365-featurefrom
heyitsaamir-simplify-apiclient-api
Jul 14, 2026
Merged

Simplify API client scoping#642
heyitsaamir merged 4 commits into
agent365-featurefrom
heyitsaamir-simplify-apiclient-api

Conversation

@heyitsaamir

@heyitsaamir heyitsaamir commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • remove per-call service URL and agentic identity overrides from low-level API clients
  • add scoped API client helpers (clone, fromServiceUrl, fromAgenticIdentity, forAgenticIdentity)
  • update app sending/activity processing to derive scoped API clients from the base app API

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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 / agenticIdentity request options from low-level API clients and normalize serviceUrl at construction time.
  • Add scoped API client helpers to @microsoft/teams.api Client and update apps pipeline code to use Client.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.

Comment thread packages/api/src/clients/index.ts
Comment thread packages/apps/src/activity-sender.ts
Comment thread packages/api/src/clients/index.ts
heyitsaamir and others added 2 commits July 13, 2026 16:24
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.

Comment thread packages/apps/src/app.ts
Comment thread packages/apps/src/app.process.ts
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
@heyitsaamir
heyitsaamir merged commit ea22572 into agent365-feature Jul 14, 2026
3 checks passed
@heyitsaamir
heyitsaamir deleted the heyitsaamir-simplify-apiclient-api branch July 14, 2026 22:23
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.

3 participants