Skip to content

Conversation

@StanBarrows
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings November 26, 2025 10:13
Copilot finished reviewing on behalf of StanBarrows November 26, 2025 10:16
Copy link

Copilot AI left a 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.

Comment on lines +13 to +18
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,
Copy link

Copilot AI Nov 26, 2025

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.

Suggested change
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,

Copilot uses AI. Check for mistakes.
Comment on lines 2041 to 2052
$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();
Copy link

Copilot AI Nov 26, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines 2059 to 2069
$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();
Copy link

Copilot AI Nov 26, 2025

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.

Copilot uses AI. Check for mistakes.
@StanBarrows StanBarrows merged commit 5cec431 into main Nov 26, 2025
11 checks passed
@StanBarrows StanBarrows deleted the feature-items branch November 26, 2025 11:06
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.

2 participants