square / connect-php-sdk

PHP client library for the Square Connect APIs
https://developer.squareup.com/docs
Apache License 2.0
114 stars 55 forks source link

No API call for CreateCatalogImage #138

Closed jove4015 closed 4 years ago

jove4015 commented 4 years ago

While there are model classes for CreateCatalogImageRequest and CreateCatalogImageResponse, there is no actual API call on CatalogAPI called createCatalogImage. If you try to use upsertCatalogObject or batchUpsertCatalogObjects with images, it will not work and it says you must use createCatalogImage.

Expected Behavior:

$api = new \SquareConnect\Api\CatalogApi($api_client); $body = new \SquareConnect\Model\CreateCatalogImageRequest();

$result = $api->createCatalogImage($body);

// $result should be type \SquareConnect\Model\CreateCatalogImageResponse.

Actual result:

Throws fatal error: Call to undefined method SquareConnect\Api\CatalogApi::createCatalogImage()

I've checked the whole repo and no such method is defined on any API.

Also, the published Square spec seems to indicate that you need to include the actual binary image itself as a multipart attachment on the request. There appears to be no facility in CreateCatalogImageRequest to set the binary image data. Also, it suggests you should specify a URL, which the spec says is a read-only attribute. In general this request object doesn't seem to line up with the API.

StephenJosey commented 4 years ago

This endpoint does not currently exist within any of our SDKs, unfortunately. For an example in cURL, you can take a look here: https://developer.squareup.com/docs/catalog-api/cookbook/create-catalog-image