Skip to content

Wire up missing organization Refit clients and fix ChannelUtilization route parameter (fixes #337) - #358

Merged
rolandbanks merged 2 commits into
mainfrom
fix/issue-337-organization-section-wiring
Aug 3, 2026
Merged

Wire up missing organization Refit clients and fix ChannelUtilization route parameter (fixes #337)#358
rolandbanks merged 2 commits into
mainfrom
fix/issue-337-organization-section-wiring

Conversation

@rolandbanks

Copy link
Copy Markdown
Contributor

Fixes #337.

What was wrong

Two separate defects, both reported in #337.

1. Organization Refit clients never assigned. The MerakiClient constructor did not assign these, so they were still null after construction and threw NullReferenceException on first use:

  • Organizations.Summary.SwitchPower
  • Organizations.Appliance.Uplinks.Usage
  • Organizations.Wireless.Devices.Latency
  • Organizations.Wireless.Devices.PacketLoss
  • Organizations.Wireless.Devices.ChannelUtilization

Summary was initialized with only Top, and there was no initializer block at all for Organizations.Appliance or Organizations.Wireless.

2. IOrganizationsWirelessDevicesChannelUtilization could not be built by Refit. All four of its methods spelled the parameter orgnanizationId while the route templates used {organizationId}, so RestService.For<T>() threw:

ArgumentException: URL /organizations/{organizationId}/wireless/devices/channelUtilization/byDevice
has parameter organizationid, but no method parameter matches

This one had to be fixed for the wiring to work, since wiring it up without the fix would throw at new MerakiClient(...) for every consumer.

What changed

  • MerakiClient.cs: added the Appliance, Summary.SwitchPower and Wireless initializer entries, placed in the existing alphabetical order.
  • IOrganizationsWirelessDevicesChannelUtilization.cs: parameter renamed to organizationId on all four methods, with the matching <param> doc tags.
  • MerakiClientSectionWiringTests.cs: new. Needs no network and no API key, because the wiring happens entirely in the constructor.
  • CHANGELOG.md: entry under 1.70.42. The version heading is a guess and may need correcting at release.

A second commit fixes 9 pre-existing IDE0058 violations in the test project. .editorconfig sets csharp_style_unused_value_expression_statement_preference = discard_variable, and these statements discarded their value implicitly. Style only, no behaviour change. Happy to drop that commit if you would rather keep it separate.

Verification

The wider test suite was deliberately not run, since it exercises and mutates a live Meraki organization.

Scope note

This PR closes the five cases named in #337 and nothing more. A reflection census of the section tree found that 82 further Refit clients and 4 sub-section objects are still left null by the constructor, from the same root cause: the constructor is a hand-maintained initializer mirroring a 134-class section tree, with no test asserting it is complete.

That is raised separately as #357, which also flags two more interfaces carrying the identical orgnanizationId typo (IOrganizationsVpnSiteToSiteIpsec and ICameraCustomAnalyticsArtifacts). They are harmless today only because nothing wires them up, and they will start throwing for everyone the moment the wiring gap is closed.

🤖 Generated with Claude Code

rolandbanks and others added 2 commits August 3, 2026 10:30
The MerakiClient constructor never assigned several organization-level
Refit clients, so they were still null after construction and threw
NullReferenceException on first use:

  Organizations.Summary.SwitchPower
  Organizations.Appliance.Uplinks.Usage
  Organizations.Wireless.Devices.Latency
  Organizations.Wireless.Devices.PacketLoss
  Organizations.Wireless.Devices.ChannelUtilization

IOrganizationsWirelessDevicesChannelUtilization additionally could not be
built by Refit at all. All four of its methods spelled the parameter
"orgnanizationId" while the route templates used {organizationId}, so
RestService.For<T>() threw:

  ArgumentException: URL /organizations/{organizationId}/wireless/devices/
  channelUtilization/byDevice has parameter organizationid, but no method
  parameter matches

The parameter is now organizationId throughout. Callers using named
arguments would need to update, but the interface could not be
constructed before this fix, so nothing could have called it.

Adds MerakiClientSectionWiringTests, which needs no network and no API
key because the wiring happens entirely in the constructor.

This closes the five cases in #337 only. A reflection census of the
section tree shows 82 further Refit clients and 4 sub-sections are still
left null by the constructor; that is tracked separately in #357.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
.editorconfig sets csharp_style_unused_value_expression_statement_preference
to discard_variable, which surfaces as IDE0058 in the IDE. Nine statements
in the test project discarded their value implicitly. They now use the
explicit discard, matching the rest of the test project.

Behaviour is unchanged; this is a style-only fix.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 8 complexity

Metric Results
Complexity 8

View in Codacy

AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@rolandbanks
rolandbanks merged commit eedfb33 into main Aug 3, 2026
4 checks passed
rolandbanks added a commit that referenced this pull request Aug 3, 2026
The entry added with the #337 fix guessed 1.70.42. The merge of #358 put
main at 1.70.44, so this commit is 1.70.45.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

MerakiClient constructor omits organization Refit clients used by Dashboard API; IOrganizationsWirelessDevicesChannelUtilization fails Refit build

1 participant