-
Notifications
You must be signed in to change notification settings - Fork 3
Feature Items #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Items #53
Conversation
There was a problem hiding this comment.
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 adds support for Items (Articles) management in the Bexio API SDK. It implements full CRUD operations and search functionality for items, following the existing patterns established in the codebase for other resources like Contacts, Notes, and Files.
Key changes include:
- Six new request classes for fetching, searching, creating, editing, and deleting items
- Two DTO classes for representing item data and create/edit operations
- An OrderByEnum for item sorting options
- Comprehensive test coverage with fixtures for all operations
- Documentation updates in README with usage examples
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Requests/Items/*.php | Six request classes implementing CRUD and search operations for items |
| src/Dto/Items/ItemDTO.php | DTO for representing item data from API responses |
| src/Dto/Items/CreateEditItemDTO.php | DTO for create and edit item request payloads |
| src/Enums/Items/OrderByEnum.php | Enum defining sorting options for item queries |
| tests/Requests/Items/*.php | Test files for all item request classes |
| tests/Fixtures/Saloon/Items/*.json | Mock response fixtures for testing |
| README.md | Documentation updates with usage examples and enum/DTO listings |
| .gitbook.yaml | Removed gitbook configuration file |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public ?int $user_id, | ||
| public int $article_type_id, | ||
| public ?int $contact_id, | ||
| public ?string $deliverer_code, | ||
| public ?string $deliverer_name, | ||
| public ?string $deliverer_description, |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nullable parameters without default values ($user_id, $contact_id, $deliverer_code, $deliverer_name, $deliverer_description) must be provided when instantiating this DTO, making them effectively required. This is confusing for API consumers. These parameters should either have = null defaults to make them truly optional, or be marked as non-nullable if they're required. The current signature creates ambiguity about which parameters are actually optional.
| public ?int $user_id, | |
| public int $article_type_id, | |
| public ?int $contact_id, | |
| public ?string $deliverer_code, | |
| public ?string $deliverer_name, | |
| public ?string $deliverer_description, | |
| public ?int $user_id = null, | |
| public int $article_type_id, | |
| public ?int $contact_id = null, | |
| public ?string $deliverer_code = null, | |
| public ?string $deliverer_name = null, | |
| public ?string $deliverer_description = null, |
| $item = $connector->send(new CreateItemRequest( | ||
| data: new CreateEditItemDTO( | ||
| article_type_id: 1, | ||
| intern_code: 'ITEM-001', | ||
| intern_name: 'Test Item', | ||
| intern_description: 'Item Description', | ||
| sale_price: '20.00', | ||
| purchase_price: '10.00', | ||
| currency_id: 1, | ||
| unit_id: 1, | ||
| ) | ||
| ))->dto(); |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example is missing required parameters for CreateEditItemDTO. Parameters user_id, contact_id, deliverer_code, deliverer_name, and deliverer_description don't have default values in the DTO constructor, so they must be provided when instantiating. This code will fail with an ArgumentCountError. Either add these parameters to the example with appropriate values (or null), or update the DTO to provide default values for these parameters.
| $item = $connector->send(new EditAnItemRequest( | ||
| article_id: 1, | ||
| data: new CreateEditItemDTO( | ||
| article_type_id: 1, | ||
| intern_code: 'ITEM-001', | ||
| intern_name: 'Updated Item Name', | ||
| intern_description: 'Updated Description', | ||
| sale_price: '25.00', | ||
| purchase_price: '15.00', | ||
| ) | ||
| ))->dto(); |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example is missing required parameters for CreateEditItemDTO. Parameters user_id, contact_id, deliverer_code, deliverer_name, and deliverer_description don't have default values in the DTO constructor, so they must be provided when instantiating. This code will fail with an ArgumentCountError. Either add these parameters to the example with appropriate values (or null), or update the DTO to provide default values for these parameters.
No description provided.