Skip to content

NXC-301: Update ToQueryString and usage - #17

Merged
raymens merged 2 commits into
mainfrom
update-toquerystring
Jun 25, 2026
Merged

NXC-301: Update ToQueryString and usage#17
raymens merged 2 commits into
mainfrom
update-toquerystring

Conversation

@PJvGrol

@PJvGrol PJvGrol commented Jun 24, 2026

Copy link
Copy Markdown
Member

This pull request refactors the way query strings are generated and appended to API URLs throughout the SDK, replacing the previous CreateUriQuery method with a new, more robust ToQueryString implementation. It also updates all usages to ensure proper URL encoding of query parameters, which improves reliability and correctness when dealing with special characters. Unit tests are updated accordingly to match the new encoding behavior.

Core refactoring and improvements:

  • Replaced the CreateUriQuery method with a new ToQueryString method in BaseService, supporting both Dictionary<string, string> and object inputs, and ensuring all query parameter keys are camelCased and values are properly URL-encoded.
  • Updated all service methods to use ToQueryString instead of CreateUriQuery for building query strings in API requests, affecting files such as NexusAPIService.cs, CustomerPersonService.cs, CustomerService.cs, DocumentStoreRecordService.cs, and DocumentStoreTypeService.cs. [1] [2] [3] [4] [5] [6] [7]

Testing and encoding fixes:

  • Updated test cases to expect URL-encoded query parameters (e.g., : encoded as %3A), ensuring tests reflect the new query string behavior and encoding. [1] [2] [3] [4]

Minor codebase updates:

  • Added missing using System.Globalization; and using System.Reflection; directives required by the new ToQueryString implementation in BaseService.cs.

Copilot AI review requested due to automatic review settings June 24, 2026 10:15

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 query strings are constructed across the SDK by replacing the prior CreateUriQuery approach with a new ToQueryString implementation, and updates affected service calls and tests so query parameters are properly URL-encoded (notably for characters like : and |).

Changes:

  • Introduced BaseService.ToQueryString(...) and updated multiple service methods to use it when building request URLs.
  • Updated test expectations to match URL-encoded query parameter behavior.
  • Added required using directives for the new reflection/casing logic in BaseService.

Reviewed changes

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

Show a summary per file
File Description
tests/Nexus.Crypto.SDK.Tests/TransactionControllerTests.cs Updates mocked request URI to expect encoded query parameters.
tests/Nexus.Crypto.SDK.Tests/NexusLabelApiSdkTests.cs Updates mocked request URIs (and a Dictionary type usage) to align with encoded query strings.
src/Nexus.Crypto.SDK/Services/BaseService.cs Replaces CreateUriQuery with ToQueryString (dictionary + object overload) and adds camel-casing + URL encoding.
src/Nexus.Crypto.SDK/NexusAPIService.cs Switches several endpoints to use the new ToQueryString for dictionary-based query parameters.
src/Nexus.Crypto.SDK/Services/DocumentStoreTypeService.cs Updates URL construction to use BaseService.ToQueryString.
src/Nexus.Crypto.SDK/Services/DocumentStoreRecordService.cs Updates URL construction to use BaseService.ToQueryString.
src/Nexus.Crypto.SDK/Services/CustomerService.cs Updates URL construction to use BaseService.ToQueryString.
src/Nexus.Crypto.SDK/Services/CustomerPersonService.cs Updates URL construction to use BaseService.ToQueryString.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Nexus.Crypto.SDK/Services/BaseService.cs
Comment thread src/Nexus.Crypto.SDK/Services/BaseService.cs
raymens
raymens previously approved these changes Jun 24, 2026
@raymens
raymens enabled auto-merge (squash) June 24, 2026 10:42
@raymens
raymens merged commit 2415fb0 into main Jun 25, 2026
5 checks passed
@raymens
raymens deleted the update-toquerystring branch June 25, 2026 06:50
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