NXC-246: Refactor Document Store services and interfaces for improved structure - #13
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the SDK’s Document Store surface area by introducing a single DocumentStore entry point on NexusAPIService, moving Document Store models into a dedicated namespace, and shifting several services from inheritance to composition over BaseService for cleaner encapsulation.
Changes:
- Added
IDocumentStoreService/DocumentStoreServiceand exposed it viaNexusAPIService.DocumentStore. - Refactored Document Store-related services (and
CustomerService) to take aBaseServiceinstance instead of inheriting fromBaseService. - Moved Document Store models into
Nexus.Crypto.SDK.Models.DocumentStoreand updated service/interface imports accordingly.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Nexus.Crypto.SDK/Services/IDocumentStoreTypeService.cs | Updated imports to new Document Store model namespace. |
| src/Nexus.Crypto.SDK/Services/IDocumentStoreSettingsService.cs | Updated imports to new Document Store model namespace. |
| src/Nexus.Crypto.SDK/Services/IDocumentStoreService.cs | New interface aggregating Document Store sub-services. |
| src/Nexus.Crypto.SDK/Services/IDocumentStoreRecordService.cs | Updated imports to new Document Store model namespace. |
| src/Nexus.Crypto.SDK/Services/DocumentStoreTypeService.cs | Refactored to use composition over BaseService and standardized API version constant usage. |
| src/Nexus.Crypto.SDK/Services/DocumentStoreSettingsService.cs | Refactored to use composition over BaseService. |
| src/Nexus.Crypto.SDK/Services/DocumentStoreService.cs | New facade service to group document store operations (types/settings/records). |
| src/Nexus.Crypto.SDK/Services/DocumentStoreRecordService.cs | Refactored to use composition over BaseService and centralized API version constant usage. |
| src/Nexus.Crypto.SDK/Services/CustomerService.cs | Refactored to use composition over BaseService and centralized API version/date format constants. |
| src/Nexus.Crypto.SDK/Services/BaseService.cs | Exposed version/date constants, added public AddHeader, and widened CreateUriQuery visibility. |
| src/Nexus.Crypto.SDK/NexusAPIService.cs | Replaced individual document store properties with DocumentStore facade and updated service instantiation pattern. |
| src/Nexus.Crypto.SDK/Models/DocumentStore/DocumentStoreType.cs | Moved model to Models.DocumentStore namespace. |
| src/Nexus.Crypto.SDK/Models/DocumentStore/DocumentStoreSettings.cs | Moved model to Models.DocumentStore namespace. |
| src/Nexus.Crypto.SDK/Models/DocumentStore/DocumentStoreRecord.cs | Moved model to Models.DocumentStore namespace. |
| src/Nexus.Crypto.SDK/INexusAPIService.cs | Updated public API contract to expose DocumentStore facade instead of 3 separate properties. |
Comments suppressed due to low confidence (1)
src/Nexus.Crypto.SDK/Services/BaseService.cs:178
CreateUriQueryconcatenates raw keys/values without URL-encoding. This will generate invalid/ambiguous URIs when values contain reserved characters (spaces,&,=,/, etc.) and is now more visible since the method ispublic. Encode keys/values (e.g., viaUri.EscapeDataString) when building the query string.
public static string CreateUriQuery(Dictionary<string, string> queryParams)
{
var query = string.Empty;
foreach (var p in queryParams)
{
if (query == string.Empty)
{
query += "?";
}
else
{
query += "&";
}
query += $"{p.Key}={p.Value}";
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AsimaksiAnt
previously approved these changes
May 19, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
AsimaksiAnt
approved these changes
May 19, 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 Document Store-related services in the SDK to improve modularity, encapsulation, and maintainability. It introduces a new
DocumentStoreServiceas a single entry point for document store operations, updates service constructors for better dependency management, and consolidates model namespaces. Several methods are also updated for consistency and clarity.Document Store Service Refactor and API Improvements:
IDocumentStoreServiceinterface andDocumentStoreServiceimplementation, consolidating access to document store types, settings, and records under a single service property (DocumentStore) inNexusAPIService. [1] [2] [3] [4]DocumentStoreTypeService,DocumentStoreSettingsService,DocumentStoreRecordService,CustomerService) to accept aBaseServiceinstance (composition) instead of directly inheriting from it, improving testability and encapsulation. [1] [2] [3] [4]Namespace and Model Organization:
Nexus.Crypto.SDK.Models.DocumentStorenamespace and updated all relevant service and interface files to use the new namespace. [1] [2] [3] [4] [5] [6] [7] [8]Base Service and Utility Method Updates:
BaseServiceto bepublicorprivateas appropriate, and moved API version constants to be public for consistent use across services. Also, added a publicAddHeadermethod for header management. [1] [2] [3]API Version Consistency:
BaseService.ApiVersion1_2) across all service methods, replacing hardcoded strings and previous constants for better maintainability. [1] [2] [3] [4] [5] [6] [7]Minor Cleanups:
These changes collectively make the SDK’s document store functionality more modular, easier to maintain, and consistent in its API usage.