Skip to content

Inherit ManagementApiClient to remove redundant initialization#936

Open
kailash-b wants to merge 1 commit intov8from
feat/SDK-7748
Open

Inherit ManagementApiClient to remove redundant initialization#936
kailash-b wants to merge 1 commit intov8from
feat/SDK-7748

Conversation

@kailash-b
Copy link
Contributor

Changes

ManagementClient previously implemented IManagementApiClient directly, duplicating every client property assignment that already exists in the generated ManagementApiClient. This meant any new endpoint added by code generation would break ManagementClient (missing property, broken interface) and call for manual updates.

What changed:

  • ManagementClient now inherits from ManagementApiClient instead of implementing IManagementApiClient directly. All endpoint properties (Actions, Users, Organizations, etc.) are inherited automatically — keeping ManagementClient permanently in sync with generated code without any manual intervention.
  • Added ManagementApiClient.Internal.cs (partial class) with an internal SetAuthorizationHeader(Func<Task<string>>) method. This is the minimal seam needed to wire the ITokenProvider dynamic token supplier into the RawClient headers post-construction, without modifying generated code.
  • Constructor logic in ManagementClient refactored into two private static helpers (Validate, BuildClientOptions)

References

N/A

Testing

  • This change adds unit test coverage
  • This change adds integration test coverage
  • This change has been tested on the latest version of the platform/language or why not

Checklist

@kailash-b kailash-b requested a review from a team as a code owner March 16, 2026 18:29
@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 33.82%. Comparing base (9b23145) to head (397cd79).

Additional details and impacted files
@@            Coverage Diff             @@
##               v8     #936      +/-   ##
==========================================
- Coverage   33.89%   33.82%   -0.07%     
==========================================
  Files        1978     1979       +1     
  Lines       72861    72779      -82     
  Branches     4271     4269       -2     
==========================================
- Hits        24694    24620      -74     
+ Misses      46947    46939       -8     
  Partials     1220     1220              
Flag Coverage Δ
authIntTests 4.11% <95.23%> (+0.04%) ⬆️
mgmtIntTests 32.11% <100.00%> (-0.07%) ⬇️
unittests 0.43% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant