NXC-301: Update ToQueryString and usage - #17
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
usingdirectives for the new reflection/casing logic inBaseService.
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.
raymens
previously approved these changes
Jun 24, 2026
raymens
enabled auto-merge (squash)
June 24, 2026 10:42
raymens
approved these changes
Jun 25, 2026
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.
This pull request refactors the way query strings are generated and appended to API URLs throughout the SDK, replacing the previous
CreateUriQuerymethod with a new, more robustToQueryStringimplementation. 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:
CreateUriQuerymethod with a newToQueryStringmethod inBaseService, supporting bothDictionary<string, string>and object inputs, and ensuring all query parameter keys are camelCased and values are properly URL-encoded.ToQueryStringinstead ofCreateUriQueryfor building query strings in API requests, affecting files such asNexusAPIService.cs,CustomerPersonService.cs,CustomerService.cs,DocumentStoreRecordService.cs, andDocumentStoreTypeService.cs. [1] [2] [3] [4] [5] [6] [7]Testing and encoding fixes:
:encoded as%3A), ensuring tests reflect the new query string behavior and encoding. [1] [2] [3] [4]Minor codebase updates:
using System.Globalization;andusing System.Reflection;directives required by the newToQueryStringimplementation inBaseService.cs.