Skip to content

Add Ledger API, Document Management, and Search endpoints to client library#70

Merged
jfrench9 merged 5 commits intomainfrom
feature/ledger-api
Mar 26, 2026
Merged

Add Ledger API, Document Management, and Search endpoints to client library#70
jfrench9 merged 5 commits intomainfrom
feature/ledger-api

Conversation

@jfrench9
Copy link
Member

Summary

This PR introduces comprehensive client library support for the Ledger API, Document Management, and Search functionality. It adds 40 new files (6,629 lines) spanning API endpoint definitions, data models, and a high-level DocumentClient extension for simplified document operations.

Key Accomplishments

Ledger API (api/ledger/)

  • Account management: List ledger accounts with filtering, retrieve account tree hierarchy
  • Transaction support: List and retrieve ledger transactions with pagination and filtering
  • Financial reporting: Get ledger summary and trial balance data
  • New models: AccountResponse, AccountTreeNode, LedgerEntryResponse, LedgerLineItemResponse, LedgerSummaryResponse, LedgerTransactionDetailResponse, LedgerTransactionSummaryResponse, TrialBalanceRow, and associated list/response wrappers
  • Added account_type field to AccountResponse, AccountTreeNode, and TrialBalanceRow models

Document Management (api/documents/)

  • CRUD operations: Upload (single and bulk), list, and delete documents
  • DocumentClient extension: High-level client that wraps raw API endpoints for ergonomic document management, integrated into RoboSystemsExtensions
  • New models: DocumentListItem, DocumentUploadRequest, BulkDocumentUploadRequest, and corresponding response models including error handling types

Search API (api/search/)

  • Document search: Full search capability with SearchRequest model supporting additional filtering options
  • Section retrieval: Fetch specific document sections by ID
  • New models: SearchHit, SearchRequest, SearchResponse, DocumentSection

Shared Infrastructure

  • PaginationInfo model for consistent paginated responses across all endpoints
  • All models registered in models/__init__.py for clean public API surface

Breaking Changes

None. This is a purely additive feature branch — no existing files were removed or had breaking modifications. The only modified files (extensions.py and models/__init__.py) received additive changes (new imports/registrations).

Testing Notes

  • Verify that all new API endpoints correctly serialize/deserialize requests and responses against the live or mocked API
  • Test DocumentClient extension methods (upload, bulk upload, list, delete) end-to-end
  • Validate ledger filtering and pagination parameters are properly passed through to API calls
  • Confirm SearchRequest additional filtering options work as expected
  • Ensure the account_type field is correctly populated across account and trial balance models

Infrastructure Considerations

  • This significantly expands the client library's API surface — documentation should be updated to cover the new Ledger, Document, and Search modules
  • The bulk upload endpoint may require attention to payload size limits and timeout configurations
  • New API endpoints imply corresponding backend services must be deployed and available before client consumers adopt this version

🤖 Generated with Claude Code

Branch Info:

  • Source: feature/ledger-api
  • Target: main
  • Type: feature

Co-Authored-By: Claude noreply@anthropic.com

## Summary

This commit introduces several new data models to the `robosystems_client` library, enhancing the API's capabilities for handling account and ledger-related information.

## Key Accomplishments

- **New Account Models**: Added `AccountListResponse`, `AccountResponse`, `AccountTreeNode`, and `AccountTreeResponse` to support account-related data structures.
- **New Ledger Models**: Introduced `LedgerEntryResponse`, `LedgerLineItemResponse`, `LedgerSummaryResponse`, `LedgerTransactionDetailResponse`, `LedgerTransactionListResponse`, and `LedgerTransactionSummaryResponse` for comprehensive ledger management.
- **Pagination Support**: Included `PaginationInfo` to facilitate paginated responses in API calls.
- **Trial Balance Models**: Added `TrialBalanceResponse` and `TrialBalanceRow` to support trial balance reporting.

## Changes Breakdown

- Updated `__init__.py` to include new models in the public API.

## Testing Notes

- Ensure that the new models are correctly integrated and accessible within the client library.

## Infrastructure Considerations

- No breaking changes introduced; existing functionality remains intact.
…BalanceRow models

## Summary

This commit enhances the `AccountResponse`, `AccountTreeNode`, and `TrialBalanceRow` models by introducing a new `account_type` field, allowing for better categorization and management of account-related data.

## Key Accomplishments

- **New Field Addition**: Added `account_type` to `AccountResponse`, `AccountTreeNode`, and `TrialBalanceRow` models, providing additional context for account classification.
- **Updated Serialization Logic**: Adjusted serialization and deserialization methods to handle the new `account_type` field appropriately.

## Changes Breakdown

- Modified `account_response.py`, `account_tree_node.py`, and `trial_balance_row.py` to include the new field and its associated logic.
- Updated `__init__.py` to ensure the new models are included in the public API.

## Testing Notes

- Verify that the new `account_type` field is correctly serialized and deserialized in API responses.
- Ensure backward compatibility with existing data structures that do not include the `account_type` field.

## Infrastructure Considerations

- No breaking changes introduced; existing functionality remains intact.
## Summary

This commit enhances the `RoboSystemsExtensions` class by integrating the `DocumentClient`, allowing for improved document management capabilities within the client library.

## Key Accomplishments

- **New Client Integration**: Added `DocumentClient` to the `RoboSystemsExtensions` class, enabling access to document-related functionalities.
- **Resource Management**: Updated the `close` method to ensure proper resource management for the new `documents` attribute.

## Changes Breakdown

- Modified `extensions.py` to include the `DocumentClient` and updated the initialization and cleanup logic accordingly.

## Testing Notes

- Verify that the `DocumentClient` is correctly instantiated and that resources are properly released during the `close` operation.

## Infrastructure Considerations

- No breaking changes introduced; existing functionality remains intact.
## Summary

This commit refactors the `DocumentClient` class to utilize dedicated API endpoints for document upload, search, and retrieval, enhancing the overall functionality and maintainability of the client.

## Key Accomplishments

- **API Integration**: Replaced direct HTTP client calls with API functions for document upload, search, and retrieval, improving code clarity and reducing redundancy.
- **Data Model Updates**: Changed return types for upload and search methods to use new response models, ensuring consistency with API responses.
- **Error Handling**: Improved error handling during document upload to provide clearer feedback on failures.

## Changes Breakdown

- Removed outdated dataclass definitions and replaced them with API model imports.
- Updated method signatures and return types in `DocumentClient` to align with new API response structures.

## Testing Notes

- Verify that document upload and search functionalities work as expected with the new API integration.
- Ensure that error handling provides appropriate feedback for failed operations.

## Infrastructure Considerations

- No breaking changes introduced; existing functionality remains intact.
…ring options

## Summary

This commit updates the `DocumentClient` and `SearchRequest` classes to include new optional parameters for enhanced search capabilities.

## Key Accomplishments

- **New Parameters**: Added `element`, `fiscal_year`, `date_from`, and `date_to` parameters to the `DocumentClient` search method, allowing for more granular filtering of search results.
- **Documentation Updates**: Improved docstrings for the `DocumentClient` and `SearchRequest` classes to reflect the new parameters and their usage.

## Changes Breakdown

- Updated method signatures and docstrings in `document_client.py` to include new filtering options.
- Removed the `semantic` parameter from `SearchRequest` as it is no longer utilized.

## Testing Notes

- Verify that the new parameters function correctly in search queries and return expected results.
- Ensure that existing functionality remains intact and that the removal of the `semantic` parameter does not affect current implementations.

## Infrastructure Considerations

- No breaking changes introduced; existing functionality remains intact.
@jfrench9 jfrench9 merged commit 19a331a into main Mar 26, 2026
1 check passed
@jfrench9 jfrench9 deleted the feature/ledger-api branch March 26, 2026 01:51
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.

1 participant