Hi Square Team,
I am preparing to upgrade the Square Java SDK from version 40.1.0.20240604 to 44.2.0.20250521.
After upgrading, I’ve noticed that I can no longer use the previous methods to retrieve properties from CatalogObject
, such as:
type
presentAtAllLocations
presentAtLocationIds
absentAtLocationIds
40.1.0.20240604
@JsonCreator
public CatalogObject(
@JsonProperty("type") String type,
@JsonProperty("id") String id,
@JsonProperty("updated_at") String updatedAt,
@JsonProperty("version") Long version,
@JsonProperty("is_deleted") Boolean isDeleted,
@JsonProperty("custom_attribute_values") Map<String, CatalogCustomAttributeValue> customAttributeValues,
@JsonProperty("catalog_v1_ids") List<CatalogV1Id> catalogV1Ids,
@JsonProperty("present_at_all_locations") Boolean presentAtAllLocations,
@JsonProperty("present_at_location_ids") List<String> presentAtLocationIds,
@JsonProperty("absent_at_location_ids") List<String> absentAtLocationIds,
44.2.0.20250521
public final class CatalogObject {
private final Value value;
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
private CatalogObject(Value value) {
this.value = value;
}
public <T> T visit(Visitor<T> visitor) {
return value.visit(visitor);
}
public static CatalogObject item(CatalogObjectItem value) {
return new CatalogObject(new ItemValue(value));
}
public static CatalogObject image(CatalogObjectImage value) {
return new CatalogObject(new ImageValue(value));
}
public static CatalogObject category(CatalogObjectCategory value) {
return new CatalogObject(new CategoryValue(value));
}
Could you please advise:
- How should I determine the type of a
CatalogObject
under the new SDK structure? - How can I retrieve the location-related information (
presentAtAllLocations
,presentAtLocationIds
,absentAtLocationIds
) from aCatalogObject
in the upgraded SDK?
This will help us adjust our current logic for catalog data synchronization to align with the new SDK design.
Thank you very much for your guidance!
Best regards,
Murphy