Skip to content

NXC-246: Refactor Document Store services and interfaces for improved structure - #13

Merged
raymens merged 3 commits into
mainfrom
share-baseservice
May 19, 2026
Merged

raymens merged 3 commits into
mainfrom
share-baseservice

Conversation

@raymens

@raymens raymens commented May 19, 2026

Copy link
Copy Markdown
Member

This pull request refactors the Document Store-related services in the SDK to improve modularity, encapsulation, and maintainability. It introduces a new DocumentStoreService as 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:

  • Introduced a new IDocumentStoreService interface and DocumentStoreService implementation, consolidating access to document store types, settings, and records under a single service property (DocumentStore) in NexusAPIService. [1] [2] [3] [4]
  • Updated all document store-related services (DocumentStoreTypeService, DocumentStoreSettingsService, DocumentStoreRecordService, CustomerService) to accept a BaseService instance (composition) instead of directly inheriting from it, improving testability and encapsulation. [1] [2] [3] [4]

Namespace and Model Organization:

  • Moved document store models into a dedicated Nexus.Crypto.SDK.Models.DocumentStore namespace 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:

  • Changed several utility methods in BaseService to be public or private as appropriate, and moved API version constants to be public for consistent use across services. Also, added a public AddHeader method for header management. [1] [2] [3]

API Version Consistency:

  • Standardized the use of the API version constant (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:

  • Applied minor formatting and parameter alignment improvements for better code readability.

These changes collectively make the SDK’s document store functionality more modular, easier to maintain, and consistent in its API usage.

Copilot AI review requested due to automatic review settings May 19, 2026 12:29
@raymens raymens changed the title Refactor Document Store services and interfaces for improved structure NXC-246: Refactor Document Store services and interfaces for improved structure May 19, 2026

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 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 / DocumentStoreService and exposed it via NexusAPIService.DocumentStore.
  • Refactored Document Store-related services (and CustomerService) to take a BaseService instance instead of inheriting from BaseService.
  • Moved Document Store models into Nexus.Crypto.SDK.Models.DocumentStore and 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

  • CreateUriQuery concatenates 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 is public. Encode keys/values (e.g., via Uri.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.

Comment thread src/Nexus.Crypto.SDK/Services/BaseService.cs
Comment thread src/Nexus.Crypto.SDK/Services/DocumentStoreRecordService.cs
Comment thread src/Nexus.Crypto.SDK/Services/DocumentStoreRecordService.cs
Comment thread src/Nexus.Crypto.SDK/Services/DocumentStoreRecordService.cs
Comment thread src/Nexus.Crypto.SDK/Services/DocumentStoreSettingsService.cs
Comment thread src/Nexus.Crypto.SDK/Services/IDocumentStoreSettingsService.cs
Comment thread src/Nexus.Crypto.SDK/NexusAPIService.cs
Comment thread src/Nexus.Crypto.SDK/NexusAPIService.cs
Comment thread src/Nexus.Crypto.SDK/NexusAPIService.cs
Comment thread src/Nexus.Crypto.SDK/Services/DocumentStoreService.cs Outdated
AsimaksiAnt
AsimaksiAnt previously approved these changes May 19, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@raymens
raymens merged commit 97b50f5 into main May 19, 2026
5 checks passed
@raymens
raymens deleted the share-baseservice branch May 19, 2026 13:28
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