API error - BatchGetInventoryCountsRequest not found

Hello,

I can get responses from many API calls but Batch retrieve inventory counts. And I need your help. I can get response from API Explorer without any issue. I am sure it would be simple mistake but I am new to the API and I can’t find the problem.

The error is generated from the below call:

$client->inventory->batchGetCounts(new BatchGetInventoryCountsRequest)

I am with PHP and error is:

Class “Square\Inventory\Requests\BatchGetInventoryCountsRequest” not found

Composer.json shows “square/square”: “^43.2”.

I made sure the API file exists at the below:

(subfolder)/vendor/square/square/src/Inventory/InventoryClient.php

And I can see the below files at ./Requests directory:

ChangesInventoryRequest.php
GetAdjustmentInventoryRequest.php
GetTransferInventoryRequest.php
DeprecatedGetAdjustmentInventoryRequest.php
GetInventoryRequest.php
DeprecatedGetPhysicalCountInventoryRequest.php
GetPhysicalCountInventoryRequest.php

Thank you!

:waving_hand: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Inventory API
Reconcile Inventory Count
Inventory API Process Flow

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

I forgot to mention that I have found the file, but I am not sure if I needed to do anything before calling it:

/square/src/Types/BatchGetInventoryCountsRequest.php

And it’s not in the “Inventory/Requests” directory.