This is despite the fact that I can definitely find the class in the source code of the JDK, which I have separately downloaded. It is under the models subpackage, where SearchCatalogObjectsRequest also resides.
My relevant Square version is 6.0.0.20200625, as betrayed by the pom file:
Not sure how you see it in the code, as the SearchCatalogItems endpoint wasn’t made available until 2020-07-22 (which in Java is 6.1.0.20200722). You can see that here in the release notes: https://github.com/square/square-java-sdk/releases.
Another one came to mind. In my application, I guarantee that CatalogItem and CatalogItemVariation IDs are unique. If I want to search for a CatalogItem or CatalogItemVariation based on its (unique) ID - let’s call it searchableID - I would not use textFilter(), but rather categoryIds(), correct? That is, I should do this:
SearchCatalogItemsRequest squareAPIRequest =
new SearchCatalogItemsRequest
.Builder()
.textFilter(Collections.singletonList(searchableID)) // A singleton list consisting of the single ID I want to search on.
.build();
instead of this:
SearchCatalogItemsRequest squareAPIRequest =
new SearchCatalogItemsRequest
.Builder()
.textFilter(searchableID)
.build();
Right? It appears to me that textFilter()will succeed, but it might return a result set with instances that have a substring similar to the ID that I’m using, which is otherwise guaranteed unique per CatalogObject I create. So I will be getting lots of potentially irrelevant answers.
Hm, I might be misunderstanding so apologies ahead of time, if so.
If you know the catalog object id (regardless if it’s an item or a variation), you can simply retrieve it using RetrieveCatalogObject (or BatchRetrieveCatalogObjects if you have several to retrieve). The categoryIds you mentioned, is actually a great way to find all items of a particular category (ex: give me all the items in the “Beverage” category), but not a great way to find a particular single object/item. Likewise, textFilter would be if you do not know the ID, and need to search by something else (say the variation name, or the SKU).
When using retrieveCatalogObjectAsync (or not Async), if the query simply fails because there is no ID of the one provided, does this mean that the relevant Object field in the response structure will be a null reference?