From 494f8fb2cf7db9f5977252bab83667a01242042a Mon Sep 17 00:00:00 2001 From: gwendalaubert Date: Thu, 22 Jun 2023 16:50:39 +0200 Subject: [PATCH 01/10] DX-104 : Adding asynchronous requests to client api --- .gitignore | 3 + Makefile | 2 +- README.md | 2 +- composer.json | 3 + composer.lock | 1079 +++++++++-------- src/AkeneoPimClientBuilder.php | 18 + src/Api/AppCatalog/AppCatalogApi.php | 6 + src/Api/AppCatalog/AppCatalogApiInterface.php | 2 + src/Api/AssetApi.php | 12 + src/Api/AssetCategoryApi.php | 12 + src/Api/AssetManager/AssetApi.php | 17 + src/Api/AssetManager/AssetApiInterface.php | 22 + src/Api/AssetManager/AssetAttributeApi.php | 9 + .../AssetAttributeApiInterface.php | 12 +- .../AssetManager/AssetAttributeOptionApi.php | 10 + .../AssetAttributeOptionApiInterface.php | 12 +- src/Api/AssetManager/AssetFamilyApi.php | 9 + .../AssetManager/AssetFamilyApiInterface.php | 10 + src/Api/AssetTagApi.php | 6 + src/Api/AssociationTypeApi.php | 12 + src/Api/AttributeApi.php | 12 + src/Api/AttributeGroupApi.php | 12 + src/Api/AttributeOptionApi.php | 11 + src/Api/AttributeOptionApiInterface.php | 27 + src/Api/CategoryApi.php | 12 + src/Api/ChannelApi.php | 12 + src/Api/FamilyApi.php | 12 + src/Api/FamilyVariantApi.php | 19 + src/Api/FamilyVariantApiInterface.php | 29 + .../Operation/UpsertableResourceInterface.php | 13 + .../UpsertableResourceListInterface.php | 12 + src/Api/ProductApi.php | 12 + src/Api/ProductModelApi.php | 18 + src/Api/ProductUuidApi.php | 12 + src/Api/ProductUuidApiInterface.php | 3 + src/Api/ReferenceEntityApi.php | 6 + src/Api/ReferenceEntityApiInterface.php | 15 +- src/Api/ReferenceEntityAttributeApi.php | 9 + .../ReferenceEntityAttributeApiInterface.php | 14 + src/Api/ReferenceEntityAttributeOptionApi.php | 13 + ...renceEntityAttributeOptionApiInterface.php | 15 + src/Api/ReferenceEntityRecordApi.php | 11 + src/Api/ReferenceEntityRecordApiInterface.php | 26 + src/Client/AuthenticatedHttpClient.php | 37 + src/Client/CachedResourceClient.php | 41 + src/Client/ClientInterface.php | 14 + src/Client/HttpClient.php | 31 +- src/Client/HttpClientInterface.php | 23 + src/Client/ResourceClient.php | 93 +- src/Client/ResourceClientInterface.php | 83 ++ src/Stream/UpsertResourceListResponse.php | 10 +- 51 files changed, 1380 insertions(+), 535 deletions(-) create mode 100644 src/Client/ClientInterface.php diff --git a/.gitignore b/.gitignore index 89aaa152..4668293e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ phpspec.yml phpunit.xml .php_cs.cache .php-cs-fixer.cache + +### PhpStorm ### +.idea diff --git a/Makefile b/Makefile index 8bc9d960..34460734 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -DOCKER_RUN = DOCKER_BUILDKIT=1 docker-compose run php_client +DOCKER_RUN ?= DOCKER_BUILDKIT=1 docker-compose run php_client .PHONY: help help: diff --git a/README.md b/README.md index 4358ada8..deeef5a1 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Matrix compatibility: | v2.3 | v3.0 | [![Build Status](https://travis-ci.org/akeneo/api-php-client.svg?branch=3.0)](https://travis-ci.org/akeneo/api-php-client) | | v3.0 - v4.0 | v4.0 - v5.0 | [![Build Status](https://travis-ci.org/akeneo/api-php-client.svg?branch=4.0)](https://travis-ci.org/akeneo/api-php-client) | | v5.0 | v6.0 | - | -| v6.0 | v7.0 to v9.1 | - | +| v6.0 | >= v7.0 | - | | - | master | [![CircleCI](https://circleci.com/gh/akeneo/api-php-client/tree/master.svg?style=svg)](https://circleci.com/gh/akeneo/api-php-client/tree/master) | Note that our PHP client is backward compatible. diff --git a/composer.json b/composer.json index 166c2d30..008191cf 100644 --- a/composer.json +++ b/composer.json @@ -45,6 +45,9 @@ "bin-dir": "bin", "platform": { "php": "8.0" + }, + "allow-plugins": { + "php-http/discovery": false } }, "suggest": { diff --git a/composer.lock b/composer.lock index b9c2f2b2..c9cbbde4 100644 --- a/composer.lock +++ b/composer.lock @@ -6,155 +6,55 @@ ], "content-hash": "e4a23e97ad1a5ad8af7dcc2efd774ff0", "packages": [ - { - "name": "guzzlehttp/psr7", - "version": "1.9.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", - "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" - }, - "suggest": { - "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://github.com/sagikazarmark" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "psr-7", - "request", - "response", - "stream", - "uri", - "url" - ], - "support": { - "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.9.0" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", - "type": "tidelift" - } - ], - "time": "2022-06-20T21:43:03+00:00" - }, { "name": "php-http/discovery", - "version": "1.14.3", + "version": "1.19.0", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "31d8ee46d0215108df16a8527c7438e96a4d7735" + "reference": "1856a119a0b0ba8da8b5c33c080aa7af8fac25b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/31d8ee46d0215108df16a8527c7438e96a4d7735", - "reference": "31d8ee46d0215108df16a8527c7438e96a4d7735", + "url": "https://api.github.com/repos/php-http/discovery/zipball/1856a119a0b0ba8da8b5c33c080aa7af8fac25b4", + "reference": "1856a119a0b0ba8da8b5c33c080aa7af8fac25b4", "shasum": "" }, "require": { + "composer-plugin-api": "^1.0|^2.0", "php": "^7.1 || ^8.0" }, "conflict": { - "nyholm/psr7": "<1.0" + "nyholm/psr7": "<1.0", + "zendframework/zend-diactoros": "*" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "*", + "psr/http-factory-implementation": "*", + "psr/http-message-implementation": "*" }, "require-dev": { + "composer/composer": "^1.0.2|^2.0", "graham-campbell/phpspec-skip-example-extension": "^5.0", "php-http/httplug": "^1.0 || ^2.0", "php-http/message-factory": "^1.0", - "phpspec/phpspec": "^5.1 || ^6.1" - }, - "suggest": { - "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories" + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "symfony/phpunit-bridge": "^6.2" }, - "type": "library", + "type": "composer-plugin", "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } + "class": "Http\\Discovery\\Composer\\Plugin", + "plugin-optional": true }, "autoload": { "psr-4": { "Http\\Discovery\\": "src/" - } + }, + "exclude-from-classmap": [ + "src/Composer/Plugin.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -166,7 +66,7 @@ "email": "mark.sagikazar@gmail.com" } ], - "description": "Finds installed HTTPlug implementations and PSR-7 message factories", + "description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations", "homepage": "http://php-http.org", "keywords": [ "adapter", @@ -175,44 +75,40 @@ "factory", "http", "message", + "psr17", "psr7" ], "support": { "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.14.3" + "source": "https://github.com/php-http/discovery/tree/1.19.0" }, - "time": "2022-07-11T14:04:40+00:00" + "time": "2023-06-19T08:45:36+00:00" }, { "name": "php-http/httplug", - "version": "2.3.0", + "version": "2.4.0", "source": { "type": "git", "url": "https://github.com/php-http/httplug.git", - "reference": "f640739f80dfa1152533976e3c112477f69274eb" + "reference": "625ad742c360c8ac580fcc647a1541d29e257f67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/httplug/zipball/f640739f80dfa1152533976e3c112477f69274eb", - "reference": "f640739f80dfa1152533976e3c112477f69274eb", + "url": "https://api.github.com/repos/php-http/httplug/zipball/625ad742c360c8ac580fcc647a1541d29e257f67", + "reference": "625ad742c360c8ac580fcc647a1541d29e257f67", "shasum": "" }, "require": { "php": "^7.1 || ^8.0", "php-http/promise": "^1.1", "psr/http-client": "^1.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "require-dev": { - "friends-of-phpspec/phpspec-code-coverage": "^4.1", - "phpspec/phpspec": "^5.1 || ^6.0" + "friends-of-phpspec/phpspec-code-coverage": "^4.1 || ^5.0 || ^6.0", + "phpspec/phpspec": "^5.1 || ^6.0 || ^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, "autoload": { "psr-4": { "Http\\Client\\": "src/" @@ -241,96 +137,36 @@ ], "support": { "issues": "https://github.com/php-http/httplug/issues", - "source": "https://github.com/php-http/httplug/tree/2.3.0" + "source": "https://github.com/php-http/httplug/tree/2.4.0" }, - "time": "2022-02-21T09:52:22+00:00" - }, - { - "name": "php-http/message-factory", - "version": "v1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-http/message-factory.git", - "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1", - "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1", - "shasum": "" - }, - "require": { - "php": ">=5.4", - "psr/http-message": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-4": { - "Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com" - } - ], - "description": "Factory interfaces for PSR-7 HTTP Message", - "homepage": "http://php-http.org", - "keywords": [ - "factory", - "http", - "message", - "stream", - "uri" - ], - "support": { - "issues": "https://github.com/php-http/message-factory/issues", - "source": "https://github.com/php-http/message-factory/tree/master" - }, - "time": "2015-12-19T14:08:53+00:00" + "time": "2023-04-14T15:10:03+00:00" }, { "name": "php-http/multipart-stream-builder", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/php-http/multipart-stream-builder.git", - "reference": "11c1d31f72e01c738bbce9e27649a7cca829c30e" + "reference": "f5938fd135d9fa442cc297dc98481805acfe2b6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/11c1d31f72e01c738bbce9e27649a7cca829c30e", - "reference": "11c1d31f72e01c738bbce9e27649a7cca829c30e", + "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/f5938fd135d9fa442cc297dc98481805acfe2b6a", + "reference": "f5938fd135d9fa442cc297dc98481805acfe2b6a", "shasum": "" }, "require": { "php": "^7.1 || ^8.0", - "php-http/discovery": "^1.7", - "php-http/message-factory": "^1.0.2", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0" + "php-http/discovery": "^1.15", + "psr/http-factory-implementation": "^1.0" }, "require-dev": { "nyholm/psr7": "^1.0", "php-http/message": "^1.5", + "php-http/message-factory": "^1.0.2", "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, "autoload": { "psr-4": { "Http\\Message\\MultipartStream\\": "src/" @@ -357,9 +193,9 @@ ], "support": { "issues": "https://github.com/php-http/multipart-stream-builder/issues", - "source": "https://github.com/php-http/multipart-stream-builder/tree/1.2.0" + "source": "https://github.com/php-http/multipart-stream-builder/tree/1.3.0" }, - "time": "2021-05-21T08:32:01+00:00" + "time": "2023-04-28T14:10:22+00:00" }, { "name": "php-http/promise", @@ -420,21 +256,21 @@ }, { "name": "psr/http-client", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/http-client.git", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31", + "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31", "shasum": "" }, "require": { "php": "^7.0 || ^8.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -454,7 +290,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP clients", @@ -466,27 +302,27 @@ "psr-18" ], "support": { - "source": "https://github.com/php-fig/http-client/tree/master" + "source": "https://github.com/php-fig/http-client/tree/1.0.2" }, - "time": "2020-06-29T06:28:15+00:00" + "time": "2023-04-10T20:12:12+00:00" }, { "name": "psr/http-factory", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + "reference": "e616d01114759c4c489f93b099585439f795fe35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", + "reference": "e616d01114759c4c489f93b099585439f795fe35", "shasum": "" }, "require": { "php": ">=7.0.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -506,7 +342,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interfaces for PSR-7 HTTP message factories", @@ -521,31 +357,31 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/master" + "source": "https://github.com/php-fig/http-factory/tree/1.0.2" }, - "time": "2019-04-30T12:38:16+00:00" + "time": "2023-04-10T20:10:41+00:00" }, { "name": "psr/http-message", - "version": "1.0.1", + "version": "1.1", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -574,53 +410,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/master" - }, - "time": "2016-08-06T14:39:51+00:00" - }, - { - "name": "ralouphie/getallheaders", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "120b605dfeb996808c31b6477290a714d356e822" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", - "reference": "120b605dfeb996808c31b6477290a714d356e822", - "shasum": "" + "source": "https://github.com/php-fig/http-message/tree/1.1" }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpunit": "^5 || ^6.5" - }, - "type": "library", - "autoload": { - "files": [ - "src/getallheaders.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" - } - ], - "description": "A polyfill for getallheaders.", - "support": { - "issues": "https://github.com/ralouphie/getallheaders/issues", - "source": "https://github.com/ralouphie/getallheaders/tree/develop" - }, - "time": "2019-03-08T08:55:37+00:00" + "time": "2023-04-04T09:50:52+00:00" }, { "name": "symfony/deprecation-contracts", @@ -691,16 +483,16 @@ }, { "name": "symfony/options-resolver", - "version": "v5.4.11", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "54f14e36aa73cb8f7261d7686691fd4d75ea2690" + "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/54f14e36aa73cb8f7261d7686691fd4d75ea2690", - "reference": "54f14e36aa73cb8f7261d7686691fd4d75ea2690", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9", + "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9", "shasum": "" }, "require": { @@ -740,7 +532,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.4.11" + "source": "https://github.com/symfony/options-resolver/tree/v5.4.21" }, "funding": [ { @@ -756,20 +548,20 @@ "type": "tidelift" } ], - "time": "2022-07-20T13:00:38+00:00" + "time": "2023-02-14T08:03:56+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85" + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", "shasum": "" }, "require": { @@ -778,7 +570,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -819,7 +611,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" }, "funding": [ { @@ -835,20 +627,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { @@ -857,7 +649,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -902,7 +694,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { @@ -918,22 +710,22 @@ "type": "tidelift" } ], - "time": "2022-05-10T07:21:04+00:00" + "time": "2022-11-03T14:55:06+00:00" } ], "packages-dev": [ { "name": "composer/pcre", - "version": "3.0.0", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd" + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/e300eb6c535192decd27a85bc72a9290f0d6b3bd", - "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd", + "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", "shasum": "" }, "require": { @@ -975,7 +767,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.0.0" + "source": "https://github.com/composer/pcre/tree/3.1.0" }, "funding": [ { @@ -991,7 +783,7 @@ "type": "tidelift" } ], - "time": "2022-02-25T20:21:48+00:00" + "time": "2022-11-17T09:50:14+00:00" }, { "name": "composer/semver", @@ -1142,32 +934,35 @@ }, { "name": "doctrine/annotations", - "version": "1.13.3", + "version": "1.14.3", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "648b0343343565c4a056bfc8392201385e8d89f0" + "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/648b0343343565c4a056bfc8392201385e8d89f0", - "reference": "648b0343343565c4a056bfc8392201385e8d89f0", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", + "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", "shasum": "" }, "require": { - "doctrine/lexer": "1.*", + "doctrine/lexer": "^1 || ^2", "ext-tokenizer": "*", "php": "^7.1 || ^8.0", "psr/cache": "^1 || ^2 || ^3" }, "require-dev": { "doctrine/cache": "^1.11 || ^2.0", - "doctrine/coding-standard": "^6.0 || ^8.1", - "phpstan/phpstan": "^1.4.10 || ^1.8.0", - "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", - "symfony/cache": "^4.4 || ^5.2", + "doctrine/coding-standard": "^9 || ^10", + "phpstan/phpstan": "~1.4.10 || ^1.8.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "symfony/cache": "^4.4 || ^5.4 || ^6", "vimeo/psalm": "^4.10" }, + "suggest": { + "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" + }, "type": "library", "autoload": { "psr-4": { @@ -1209,36 +1004,83 @@ ], "support": { "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/1.13.3" + "source": "https://github.com/doctrine/annotations/tree/1.14.3" }, - "time": "2022-07-02T10:48:51+00:00" + "time": "2023-02-01T09:20:38+00:00" + }, + { + "name": "doctrine/deprecations", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", + "reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "1.4.10 || 1.10.15", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "0.18.4", + "psr/log": "^1 || ^2 || ^3", + "vimeo/psalm": "4.30.0 || 5.12.0" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/v1.1.1" + }, + "time": "2023-06-03T09:27:29+00:00" }, { "name": "doctrine/instantiator", - "version": "1.4.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", "phpbench/phpbench": "^0.16 || ^1", "phpstan/phpstan": "^1.4", "phpstan/phpstan-phpunit": "^1", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", "autoload": { @@ -1265,7 +1107,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, "funding": [ { @@ -1281,35 +1123,37 @@ "type": "tidelift" } ], - "time": "2022-03-03T08:28:38+00:00" + "time": "2022-12-30T00:15:36+00:00" }, { "name": "doctrine/lexer", - "version": "1.2.3", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" + "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", - "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", + "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", "shasum": "" }, "require": { + "doctrine/deprecations": "^1.0", "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9.0", + "doctrine/coding-standard": "^9 || ^10", "phpstan/phpstan": "^1.3", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.11" + "psalm/plugin-phpunit": "^0.18.3", + "vimeo/psalm": "^4.11 || ^5.0" }, "type": "library", "autoload": { "psr-4": { - "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + "Doctrine\\Common\\Lexer\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -1341,7 +1185,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/1.2.3" + "source": "https://github.com/doctrine/lexer/tree/2.1.0" }, "funding": [ { @@ -1357,32 +1201,35 @@ "type": "tidelift" } ], - "time": "2022-02-28T11:07:21+00:00" + "time": "2022-12-14T08:49:07+00:00" }, { "name": "donatj/mock-webserver", - "version": "v2.5.0", + "version": "v2.6.1", "source": { "type": "git", "url": "https://github.com/donatj/mock-webserver.git", - "reference": "2850c4647e14335cf3e728cad525b701e3a2aecc" + "reference": "389fe0269970f80bfa89f064c8b7203370f63a7c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/donatj/mock-webserver/zipball/2850c4647e14335cf3e728cad525b701e3a2aecc", - "reference": "2850c4647e14335cf3e728cad525b701e3a2aecc", + "url": "https://api.github.com/repos/donatj/mock-webserver/zipball/389fe0269970f80bfa89f064c8b7203370f63a7c", + "reference": "389fe0269970f80bfa89f064c8b7203370f63a7c", "shasum": "" }, "require": { "ext-json": "*", "ext-sockets": "*", - "php": ">=5.4", + "php": ">=7.1", "ralouphie/getallheaders": "~2.0 || ~3.0" }, "require-dev": { + "corpus/coding-standard": "^0.6.0", "donatj/drop": "^1.0", "ext-curl": "*", - "phpunit/phpunit": "~4|~9" + "friendsofphp/php-cs-fixer": "^3.1", + "phpunit/phpunit": "~7|~9", + "squizlabs/php_codesniffer": "^3.6" }, "type": "library", "autoload": { @@ -1405,7 +1252,7 @@ "description": "Simple mock web server for unit testing", "support": { "issues": "https://github.com/donatj/mock-webserver/issues", - "source": "https://github.com/donatj/mock-webserver/tree/v2.5.0" + "source": "https://github.com/donatj/mock-webserver/tree/v2.6.1" }, "funding": [ { @@ -1417,7 +1264,7 @@ "type": "github" } ], - "time": "2022-07-17T04:27:21+00:00" + "time": "2022-11-28T11:26:19+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -1625,16 +1472,16 @@ }, { "name": "guzzlehttp/promises", - "version": "1.5.2", + "version": "1.5.3", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "b94b2807d85443f9719887892882d0329d1e2598" + "reference": "67ab6e18aaa14d753cc148911d273f6e6cb6721e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598", - "reference": "b94b2807d85443f9719887892882d0329d1e2598", + "url": "https://api.github.com/repos/guzzle/promises/zipball/67ab6e18aaa14d753cc148911d273f6e6cb6721e", + "reference": "67ab6e18aaa14d753cc148911d273f6e6cb6721e", "shasum": "" }, "require": { @@ -1644,11 +1491,6 @@ "symfony/phpunit-bridge": "^4.4 || ^5.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.5-dev" - } - }, "autoload": { "files": [ "src/functions_include.php" @@ -1689,7 +1531,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.2" + "source": "https://github.com/guzzle/promises/tree/1.5.3" }, "funding": [ { @@ -1705,7 +1547,112 @@ "type": "tidelift" } ], - "time": "2022-08-28T14:55:35+00:00" + "time": "2023-05-21T12:31:43+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.9.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/e4490cabc77465aaee90b20cfc9a770f8c04be6b", + "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/1.9.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2023-04-17T16:00:37+00:00" }, { "name": "http-interop/http-factory-guzzle", @@ -1767,16 +1714,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -1814,7 +1761,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -1822,7 +1769,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "phar-io/manifest", @@ -2167,24 +2114,27 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.2", + "version": "1.7.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d" + "reference": "b2fe4d22a5426f38e014855322200b97b5362c0d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b2fe4d22a5426f38e014855322200b97b5362c0d", + "reference": "b2fe4d22a5426f38e014855322200b97b5362c0d", "shasum": "" }, "require": { + "doctrine/deprecations": "^1.0", "php": "^7.4 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.13" }, "require-dev": { "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", "phpstan/phpstan-phpunit": "^1.1", @@ -2216,9 +2166,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.2" }, - "time": "2022-10-14T12:47:21+00:00" + "time": "2023-05-30T18:13:47+00:00" }, { "name": "phpspec/php-diff", @@ -2263,25 +2213,25 @@ }, { "name": "phpspec/phpspec", - "version": "7.2.0", + "version": "7.4.0", "source": { "type": "git", "url": "https://github.com/phpspec/phpspec.git", - "reference": "bbeb10f73c02bfa11d92159ad9d3e75abc3faa69" + "reference": "28faa87d1151a15848166226f33de61cb7107d0d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/phpspec/zipball/bbeb10f73c02bfa11d92159ad9d3e75abc3faa69", - "reference": "bbeb10f73c02bfa11d92159ad9d3e75abc3faa69", + "url": "https://api.github.com/repos/phpspec/phpspec/zipball/28faa87d1151a15848166226f33de61cb7107d0d", + "reference": "28faa87d1151a15848166226f33de61cb7107d0d", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.5", + "doctrine/instantiator": "^1.0.5 || ^2", "ext-tokenizer": "*", - "php": "^7.3 || 8.0.* || 8.1.*", + "php": "^7.3 || 8.0.* || 8.1.* || 8.2.*", "phpspec/php-diff": "^1.0.0", "phpspec/prophecy": "^1.9", - "sebastian/exporter": "^3.0 || ^4.0", + "sebastian/exporter": "^3.0 || ^4.0 || ^5.0", "symfony/console": "^3.4 || ^4.4 || ^5.0 || ^6.0", "symfony/event-dispatcher": "^3.4 || ^4.4 || ^5.0 || ^6.0", "symfony/finder": "^3.4 || ^4.4 || ^5.0 || ^6.0", @@ -2293,9 +2243,9 @@ }, "require-dev": { "behat/behat": "^3.3", - "phpunit/phpunit": "^8.0 || ^9.0", + "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0", "symfony/filesystem": "^3.4 || ^4.0 || ^5.0 || ^6.0", - "vimeo/psalm": "^4.3" + "vimeo/psalm": "^4.3 || ^5.2" }, "suggest": { "phpspec/nyan-formatters": "Adds Nyan formatters" @@ -2306,7 +2256,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "7.2.x-dev" + "dev-main": "7.4.x-dev" } }, "autoload": { @@ -2346,33 +2296,34 @@ ], "support": { "issues": "https://github.com/phpspec/phpspec/issues", - "source": "https://github.com/phpspec/phpspec/tree/7.2.0" + "source": "https://github.com/phpspec/phpspec/tree/7.4.0" }, - "time": "2022-03-14T09:04:31+00:00" + "time": "2023-04-21T13:17:48+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" + "reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/15873c65b207b07765dbc3c95d20fdf4a320cbe2", + "reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", + "doctrine/instantiator": "^1.2 || ^2.0", + "php": "^7.2 || 8.0.* || 8.1.* || 8.2.*", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { "phpspec/phpspec": "^6.0 || ^7.0", + "phpstan/phpstan": "^1.9", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", @@ -2413,22 +2364,69 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.17.0" + }, + "time": "2023-02-02T15:41:36+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.22.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "ec58baf7b3c7f1c81b3b00617c953249fb8cf30c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/ec58baf7b3c7f1c81b3b00617c953249fb8cf30c", + "reference": "ec58baf7b3c7f1c81b3b00617c953249fb8cf30c", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^4.15", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.22.0" }, - "time": "2021-12-08T12:19:24+00:00" + "time": "2023-06-01T12:35:21+00:00" }, { "name": "phpstan/phpstan", - "version": "1.8.11", + "version": "1.10.21", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "46e223dd68a620da18855c23046ddb00940b4014" + "reference": "b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/46e223dd68a620da18855c23046ddb00940b4014", - "reference": "46e223dd68a620da18855c23046ddb00940b4014", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5", + "reference": "b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5", "shasum": "" }, "require": { @@ -2457,8 +2455,11 @@ "static analysis" ], "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.11" + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" }, "funding": [ { @@ -2474,7 +2475,7 @@ "type": "tidelift" } ], - "time": "2022-10-24T15:45:13+00:00" + "time": "2023-06-21T20:07:58+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2775,16 +2776,16 @@ }, { "name": "phpunit/phpunit", - "version": "8.5.31", + "version": "8.5.33", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "33c126b09a42de5c99e5e8032b54e8221264a74e" + "reference": "7d1ff0e8c6b35db78ff13e3e05517d7cbf7aa32e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/33c126b09a42de5c99e5e8032b54e8221264a74e", - "reference": "33c126b09a42de5c99e5e8032b54e8221264a74e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7d1ff0e8c6b35db78ff13e3e05517d7cbf7aa32e", + "reference": "7d1ff0e8c6b35db78ff13e3e05517d7cbf7aa32e", "shasum": "" }, "require": { @@ -2852,7 +2853,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.31" + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.33" }, "funding": [ { @@ -2868,7 +2869,7 @@ "type": "tidelift" } ], - "time": "2022-10-28T05:57:37+00:00" + "time": "2023-02-27T13:04:50+00:00" }, { "name": "psr/cache", @@ -3067,28 +3068,71 @@ }, "time": "2021-07-14T16:41:46+00:00" }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" + }, { "name": "rector/rector", - "version": "0.14.6", + "version": "0.14.8", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "e61574288661334155de6e5f0f45497285abad5d" + "reference": "46ee9a173a2b2645ca92a75ffc17460139fa226e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/e61574288661334155de6e5f0f45497285abad5d", - "reference": "e61574288661334155de6e5f0f45497285abad5d", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/46ee9a173a2b2645ca92a75ffc17460139fa226e", + "reference": "46ee9a173a2b2645ca92a75ffc17460139fa226e", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.8.7" + "phpstan/phpstan": "^1.9.0" }, "conflict": { "rector/rector-doctrine": "*", "rector/rector-downgrade-php": "*", - "rector/rector-laravel": "*", "rector/rector-php-parser": "*", "rector/rector-phpoffice": "*", "rector/rector-phpunit": "*", @@ -3115,7 +3159,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.14.6" + "source": "https://github.com/rectorphp/rector/tree/0.14.8" }, "funding": [ { @@ -3123,7 +3167,7 @@ "type": "github" } ], - "time": "2022-10-15T22:58:22+00:00" + "time": "2022-11-14T14:09:49+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -3256,16 +3300,16 @@ }, { "name": "sebastian/diff", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" + "reference": "6296a0c086dd0117c1b78b059374d7fcbe7545ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/6296a0c086dd0117c1b78b059374d7fcbe7545ae", + "reference": "6296a0c086dd0117c1b78b059374d7fcbe7545ae", "shasum": "" }, "require": { @@ -3310,7 +3354,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/diff/tree/3.0.4" }, "funding": [ { @@ -3318,7 +3362,7 @@ "type": "github" } ], - "time": "2020-11-30T07:59:04+00:00" + "time": "2023-05-07T05:30:20+00:00" }, { "name": "sebastian/environment", @@ -3856,16 +3900,16 @@ }, { "name": "symfony/console", - "version": "v5.4.15", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "ea59bb0edfaf9f28d18d8791410ee0355f317669" + "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/ea59bb0edfaf9f28d18d8791410ee0355f317669", - "reference": "ea59bb0edfaf9f28d18d8791410ee0355f317669", + "url": "https://api.github.com/repos/symfony/console/zipball/560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", + "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", "shasum": "" }, "require": { @@ -3930,12 +3974,12 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command line", + "command-line", "console", "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.15" + "source": "https://github.com/symfony/console/tree/v5.4.24" }, "funding": [ { @@ -3951,20 +3995,20 @@ "type": "tidelift" } ], - "time": "2022-10-26T21:41:52+00:00" + "time": "2023-05-26T05:13:16+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.4.9", + "version": "v5.4.22", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc" + "reference": "1df20e45d56da29a4b1d8259dd6e950acbf1b13f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc", - "reference": "8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1df20e45d56da29a4b1d8259dd6e950acbf1b13f", + "reference": "1df20e45d56da29a4b1d8259dd6e950acbf1b13f", "shasum": "" }, "require": { @@ -4020,7 +4064,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.9" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.22" }, "funding": [ { @@ -4036,7 +4080,7 @@ "type": "tidelift" } ], - "time": "2022-05-05T16:45:39+00:00" + "time": "2023-03-17T11:31:58+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -4119,16 +4163,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.4.13", + "version": "v5.4.23", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "ac09569844a9109a5966b9438fc29113ce77cf51" + "reference": "b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/ac09569844a9109a5966b9438fc29113ce77cf51", - "reference": "ac09569844a9109a5966b9438fc29113ce77cf51", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5", + "reference": "b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5", "shasum": "" }, "require": { @@ -4163,7 +4207,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.13" + "source": "https://github.com/symfony/filesystem/tree/v5.4.23" }, "funding": [ { @@ -4179,20 +4223,20 @@ "type": "tidelift" } ], - "time": "2022-09-21T19:53:16+00:00" + "time": "2023-03-02T11:38:35+00:00" }, { "name": "symfony/finder", - "version": "v5.4.11", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "7872a66f57caffa2916a584db1aa7f12adc76f8c" + "reference": "078e9a5e1871fcfe6a5ce421b539344c21afef19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/7872a66f57caffa2916a584db1aa7f12adc76f8c", - "reference": "7872a66f57caffa2916a584db1aa7f12adc76f8c", + "url": "https://api.github.com/repos/symfony/finder/zipball/078e9a5e1871fcfe6a5ce421b539344c21afef19", + "reference": "078e9a5e1871fcfe6a5ce421b539344c21afef19", "shasum": "" }, "require": { @@ -4226,7 +4270,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.11" + "source": "https://github.com/symfony/finder/tree/v5.4.21" }, "funding": [ { @@ -4242,20 +4286,20 @@ "type": "tidelift" } ], - "time": "2022-07-29T07:37:50+00:00" + "time": "2023-02-16T09:33:00+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", - "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", "shasum": "" }, "require": { @@ -4270,7 +4314,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4308,7 +4352,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" }, "funding": [ { @@ -4324,20 +4368,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "433d05519ce6990bf3530fba6957499d327395c2" + "reference": "511a08c03c1960e08a883f4cffcacd219b758354" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2", - "reference": "433d05519ce6990bf3530fba6957499d327395c2", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354", "shasum": "" }, "require": { @@ -4349,7 +4393,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4389,7 +4433,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" }, "funding": [ { @@ -4405,20 +4449,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "59a8d271f00dd0e4c2e518104cc7963f655a1aa8" + "reference": "639084e360537a19f9ee352433b84ce831f3d2da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/59a8d271f00dd0e4c2e518104cc7963f655a1aa8", - "reference": "59a8d271f00dd0e4c2e518104cc7963f655a1aa8", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/639084e360537a19f9ee352433b84ce831f3d2da", + "reference": "639084e360537a19f9ee352433b84ce831f3d2da", "shasum": "" }, "require": { @@ -4432,7 +4476,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4476,7 +4520,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.27.0" }, "funding": [ { @@ -4492,20 +4536,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "219aa369ceff116e673852dce47c3a41794c14bd" + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd", - "reference": "219aa369ceff116e673852dce47c3a41794c14bd", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", "shasum": "" }, "require": { @@ -4517,7 +4561,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4560,7 +4604,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" }, "funding": [ { @@ -4576,20 +4620,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", "shasum": "" }, "require": { @@ -4604,7 +4648,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4643,7 +4687,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" }, "funding": [ { @@ -4659,20 +4703,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2" + "reference": "869329b1e9894268a8a61dabb69153029b7a8c97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/bf44a9fd41feaac72b074de600314a93e2ae78e2", - "reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97", + "reference": "869329b1e9894268a8a61dabb69153029b7a8c97", "shasum": "" }, "require": { @@ -4681,7 +4725,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4719,7 +4763,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.27.0" }, "funding": [ { @@ -4735,20 +4779,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1" + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/13f6d1271c663dc5ae9fb843a8f16521db7687a1", - "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a", + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a", "shasum": "" }, "require": { @@ -4757,7 +4801,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4798,7 +4842,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0" }, "funding": [ { @@ -4814,20 +4858,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/process", - "version": "v5.4.11", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "6e75fe6874cbc7e4773d049616ab450eff537bf1" + "reference": "e3c46cc5689c8782944274bb30702106ecbe3b64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/6e75fe6874cbc7e4773d049616ab450eff537bf1", - "reference": "6e75fe6874cbc7e4773d049616ab450eff537bf1", + "url": "https://api.github.com/repos/symfony/process/zipball/e3c46cc5689c8782944274bb30702106ecbe3b64", + "reference": "e3c46cc5689c8782944274bb30702106ecbe3b64", "shasum": "" }, "require": { @@ -4860,7 +4904,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.11" + "source": "https://github.com/symfony/process/tree/v5.4.24" }, "funding": [ { @@ -4876,7 +4920,7 @@ "type": "tidelift" } ], - "time": "2022-06-27T16:58:25+00:00" + "time": "2023-05-17T11:26:05+00:00" }, { "name": "symfony/service-contracts", @@ -4963,16 +5007,16 @@ }, { "name": "symfony/stopwatch", - "version": "v5.4.13", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "6df7a3effde34d81717bbef4591e5ffe32226d69" + "reference": "f83692cd869a6f2391691d40a01e8acb89e76fee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/6df7a3effde34d81717bbef4591e5ffe32226d69", - "reference": "6df7a3effde34d81717bbef4591e5ffe32226d69", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/f83692cd869a6f2391691d40a01e8acb89e76fee", + "reference": "f83692cd869a6f2391691d40a01e8acb89e76fee", "shasum": "" }, "require": { @@ -5005,7 +5049,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.4.13" + "source": "https://github.com/symfony/stopwatch/tree/v5.4.21" }, "funding": [ { @@ -5021,20 +5065,20 @@ "type": "tidelift" } ], - "time": "2022-09-28T13:19:49+00:00" + "time": "2023-02-14T08:03:56+00:00" }, { "name": "symfony/string", - "version": "v5.4.15", + "version": "v5.4.22", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "571334ce9f687e3e6af72db4d3b2a9431e4fd9ed" + "reference": "8036a4c76c0dd29e60b6a7cafcacc50cf088ea62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/571334ce9f687e3e6af72db4d3b2a9431e4fd9ed", - "reference": "571334ce9f687e3e6af72db4d3b2a9431e4fd9ed", + "url": "https://api.github.com/repos/symfony/string/zipball/8036a4c76c0dd29e60b6a7cafcacc50cf088ea62", + "reference": "8036a4c76c0dd29e60b6a7cafcacc50cf088ea62", "shasum": "" }, "require": { @@ -5091,7 +5135,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.15" + "source": "https://github.com/symfony/string/tree/v5.4.22" }, "funding": [ { @@ -5107,7 +5151,7 @@ "type": "tidelift" } ], - "time": "2022-10-05T15:16:54+00:00" + "time": "2023-03-14T06:11:53+00:00" }, { "name": "symfony/yaml", @@ -5182,16 +5226,16 @@ }, { "name": "symplify/easy-coding-standard", - "version": "11.1.16", + "version": "11.5.0", "source": { "type": "git", - "url": "https://github.com/symplify/easy-coding-standard.git", - "reference": "32ebd57f0f47713540df8ea39134adaa9d912fae" + "url": "https://github.com/easy-coding-standard/easy-coding-standard.git", + "reference": "1d2400f7bfe92e3754ce71f0782f2c0521bade3d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symplify/easy-coding-standard/zipball/32ebd57f0f47713540df8ea39134adaa9d912fae", - "reference": "32ebd57f0f47713540df8ea39134adaa9d912fae", + "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/1d2400f7bfe92e3754ce71f0782f2c0521bade3d", + "reference": "1d2400f7bfe92e3754ce71f0782f2c0521bade3d", "shasum": "" }, "require": { @@ -5199,17 +5243,13 @@ }, "conflict": { "friendsofphp/php-cs-fixer": "<3.0", - "squizlabs/php_codesniffer": "<3.6" + "squizlabs/php_codesniffer": "<3.6", + "symplify/coding-standard": "<11.3" }, "bin": [ "bin/ecs" ], "type": "library", - "extra": { - "branch-alias": { - "dev-main": "10.3-dev" - } - }, "autoload": { "files": [ "bootstrap.php" @@ -5219,9 +5259,16 @@ "license": [ "MIT" ], - "description": "Prefixed scoped version of ECS package", + "description": "Use Coding Standard with 0-knowledge of PHP-CS-Fixer and PHP_CodeSniffer", + "keywords": [ + "Code style", + "automation", + "fixer", + "static analysis" + ], "support": { - "source": "https://github.com/symplify/easy-coding-standard/tree/11.1.16" + "issues": "https://github.com/easy-coding-standard/easy-coding-standard/issues", + "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/11.5.0" }, "funding": [ { @@ -5233,7 +5280,7 @@ "type": "github" } ], - "time": "2022-10-27T10:48:13+00:00" + "time": "2023-06-21T06:26:15+00:00" }, { "name": "theseer/tokenizer", diff --git a/src/AkeneoPimClientBuilder.php b/src/AkeneoPimClientBuilder.php index dd3ffa78..65c58792 100644 --- a/src/AkeneoPimClientBuilder.php +++ b/src/AkeneoPimClientBuilder.php @@ -257,6 +257,24 @@ protected function setUp(Authentication $authentication): array $httpClient = new HttpClient($this->getHttpClient(), $this->getRequestFactory(), $this->getStreamFactory(), $this->options); $authenticationApi = new AuthenticationApi($httpClient, $uriGenerator); + + if ( + null === $authentication->getAccessToken() + && null !== $authentication->getUsername() + && null !== $authentication->getPassword() + ) { + $tokens = $authenticationApi->authenticateByPassword( + $authentication->getClientId(), + $authentication->getSecret(), + $authentication->getUsername(), + $authentication->getPassword() + ); + + $authentication + ->setAccessToken($tokens['access_token']) + ->setRefreshToken($tokens['refresh_token']); + } + $authenticatedHttpClient = new AuthenticatedHttpClient($httpClient, $authenticationApi, $authentication); $multipartStreamBuilderFactory = new MultipartStreamBuilderFactory($this->getStreamFactory()); diff --git a/src/Api/AppCatalog/AppCatalogApi.php b/src/Api/AppCatalog/AppCatalogApi.php index a2d52cd8..93d9d188 100644 --- a/src/Api/AppCatalog/AppCatalogApi.php +++ b/src/Api/AppCatalog/AppCatalogApi.php @@ -10,6 +10,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -60,4 +61,9 @@ public function delete(string $code): int { return $this->resourceClient->deleteResource(static::APP_CATALOG_URI, [$code]); } + + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncAndReturnPromise(static::APP_CATALOG_URI, [$code], $data, $onSuccess, $onFail); + } } diff --git a/src/Api/AppCatalog/AppCatalogApiInterface.php b/src/Api/AppCatalog/AppCatalogApiInterface.php index 63e3896e..756e064a 100644 --- a/src/Api/AppCatalog/AppCatalogApiInterface.php +++ b/src/Api/AppCatalog/AppCatalogApiInterface.php @@ -7,6 +7,7 @@ use Akeneo\Pim\ApiClient\Api\Operation\DeletableResourceInterface; use Akeneo\Pim\ApiClient\Api\Operation\GettableResourceInterface; use Akeneo\Pim\ApiClient\Api\Operation\ListableResourceInterface; +use GuzzleHttp\Promise\PromiseInterface; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -20,4 +21,5 @@ interface AppCatalogApiInterface extends public function create(array $data): array; public function upsert(string $code, array $data = []): array; + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/AssetApi.php b/src/Api/AssetApi.php index 83ebb940..dd2a42af 100644 --- a/src/Api/AssetApi.php +++ b/src/Api/AssetApi.php @@ -10,6 +10,8 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; +use Psr\Http\Message\StreamInterface; /** * API implementation to manage assets. @@ -89,6 +91,11 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSET_URI, [$code], $data); } + public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::ASSET_URI, [$code], $data, $onSuccess, $onFail); + } + /** * {@inheritdoc} */ @@ -96,4 +103,9 @@ public function upsertList($resources): \Traversable { return $this->resourceClient->upsertStreamResourceList(static::ASSETS_URI, [], $resources); } + + public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncStreamResourceList(self::ASSETS_URI, [], $resources, $onSuccess, $onFail); + } } diff --git a/src/Api/AssetCategoryApi.php b/src/Api/AssetCategoryApi.php index 8f672d7e..23e2534f 100644 --- a/src/Api/AssetCategoryApi.php +++ b/src/Api/AssetCategoryApi.php @@ -10,6 +10,8 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; +use Psr\Http\Message\StreamInterface; /** * API implementation to manage asset categories. @@ -74,6 +76,11 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSET_CATEGORY_URI, [$code], $data); } + public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::ASSET_CATEGORY_URI, [$code], $data, $onSuccess, $onFail); + } + /** * {@inheritdoc} */ @@ -95,4 +102,9 @@ public function create(string $code, array $data = []): int return $this->resourceClient->createResource(static::ASSET_CATEGORIES_URI, [], $data); } + + public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncStreamResourceList(static::ASSET_CATEGORIES_URI, [], $resources, $onSuccess, $onFail); + } } diff --git a/src/Api/AssetManager/AssetApi.php b/src/Api/AssetManager/AssetApi.php index f9390958..bb153320 100644 --- a/src/Api/AssetManager/AssetApi.php +++ b/src/Api/AssetManager/AssetApi.php @@ -8,6 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; class AssetApi implements AssetApiInterface { @@ -70,4 +71,20 @@ public function delete(string $assetFamilyCode, string $assetCode): int { return $this->resourceClient->deleteResource(static::ASSET_URI, [$assetFamilyCode, $assetCode]); } + + /** + * {@inheritdoc} + */ + public function upsertAsync (string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::ASSET_URI, [$assetFamilyCode, $assetCode], $data, $onSuccess, $onFail); + } + + /** + * {@inheritdoc} + */ + public function upsertAsyncList (string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncJsonResourceList(static::ASSETS_URI, [$assetFamilyCode], $assets, $onSuccess, $onFail); + } } diff --git a/src/Api/AssetManager/AssetApiInterface.php b/src/Api/AssetManager/AssetApiInterface.php index 07fe5b36..589a0bb7 100644 --- a/src/Api/AssetManager/AssetApiInterface.php +++ b/src/Api/AssetManager/AssetApiInterface.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; interface AssetApiInterface { @@ -56,6 +57,27 @@ public function upsert(string $assetFamilyCode, string $assetCode, array $data = */ public function upsertList(string $assetFamilyCode, array $assets): array; + /** + * Creates an asset family if it does not exist yet, otherwise updates partially the asset family. + * + * @throws HttpException + * + * @return PromiseInterface + */ + public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = []): PromiseInterface; + + /** + * Updates or creates several assets. + * + * @param string $assetFamilyCode Code of the asset family + * @param array $assets Array containing the assets to create or update + * + * @throws HttpException + * + * @return PromiseInterface + */ + public function upsertAsyncList(string $assetFamilyCode, array $assets): PromiseInterface; + /** * Deletes an asset. * diff --git a/src/Api/AssetManager/AssetAttributeApi.php b/src/Api/AssetManager/AssetAttributeApi.php index d9c8eef1..f329b638 100644 --- a/src/Api/AssetManager/AssetAttributeApi.php +++ b/src/Api/AssetManager/AssetAttributeApi.php @@ -5,6 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; +use GuzzleHttp\Promise\PromiseInterface; class AssetAttributeApi implements AssetAttributeApiInterface { @@ -39,4 +40,12 @@ public function upsert(string $assetFamilyCode, string $attributeCode, array $da { return $this->resourceClient->upsertResource(static::ASSET_ATTRIBUTE_URI, [$assetFamilyCode, $attributeCode], $data); } + + /** + * {@inheritdoc} + */ + public function upsertAsync (string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::ASSET_ATTRIBUTE_URI, [$assetFamilyCode, $attributeCode], $data, $onSuccess, $onFail); + } } diff --git a/src/Api/AssetManager/AssetAttributeApiInterface.php b/src/Api/AssetManager/AssetAttributeApiInterface.php index a1ccbf76..3b6d9563 100644 --- a/src/Api/AssetManager/AssetAttributeApiInterface.php +++ b/src/Api/AssetManager/AssetAttributeApiInterface.php @@ -5,6 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Exception\HttpException; +use GuzzleHttp\Promise\PromiseInterface; interface AssetAttributeApiInterface { @@ -23,7 +24,7 @@ public function get(string $assetFamilyCode, string $attributeCode): array; public function all(string $assetFamilyCode, array $queryParameters = []): array; /** - * Creates a asset attribute if it does not exist yet, otherwise updates partially the attribute. + * Creates an asset attribute if it does not exist yet, otherwise updates partially the attribute. * * @throws HttpException * @@ -31,4 +32,13 @@ public function all(string $assetFamilyCode, array $queryParameters = []): array * Status code 204 indicating that the asset attribute has been well updated. */ public function upsert(string $assetFamilyCode, string $attributeCode, array $data = []): int; + + /** + * Creates an asset attribute if it does not exist yet, otherwise updates partially the attribute. + * + * @throws HttpException + * + * @return PromiseInterface + */ + public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = []): PromiseInterface; } diff --git a/src/Api/AssetManager/AssetAttributeOptionApi.php b/src/Api/AssetManager/AssetAttributeOptionApi.php index 062669a3..c915e6f1 100644 --- a/src/Api/AssetManager/AssetAttributeOptionApi.php +++ b/src/Api/AssetManager/AssetAttributeOptionApi.php @@ -5,6 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; +use GuzzleHttp\Promise\PromiseInterface; class AssetAttributeOptionApi implements AssetAttributeOptionApiInterface { @@ -49,4 +50,13 @@ public function upsert(string $assetFamilyCode, string $attributeCode, string $a $data ); } + + public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource( + static::ASSET_ATTRIBUTE_OPTION_URI, + [$assetFamilyCode, $attributeCode, $attributeOptionCode], + $data + ); + } } diff --git a/src/Api/AssetManager/AssetAttributeOptionApiInterface.php b/src/Api/AssetManager/AssetAttributeOptionApiInterface.php index 510d0724..f77bd4df 100644 --- a/src/Api/AssetManager/AssetAttributeOptionApiInterface.php +++ b/src/Api/AssetManager/AssetAttributeOptionApiInterface.php @@ -5,6 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Exception\HttpException; +use GuzzleHttp\Promise\PromiseInterface; interface AssetAttributeOptionApiInterface { @@ -23,7 +24,7 @@ public function get(string $assetFamilyCode, string $attributeCode, string $attr public function all(string $assetFamilyCode, string $attributeCode): array; /** - * Creates a asset attribute option if it does not exist yet, otherwise updates partially the attribute option. + * Creates an asset attribute option if it does not exist yet, otherwise updates partially the attribute option. * * @throws HttpException * @@ -31,4 +32,13 @@ public function all(string $assetFamilyCode, string $attributeCode): array; * Status code 204 indicating that the asset attribute option has been well updated. */ public function upsert(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = []): int; + + /** + * Creates an asset attribute option if it does not exist yet, otherwise updates partially the attribute option. + * + * @throws HttpException + * + * @return PromiseInterface + */ + public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface; } diff --git a/src/Api/AssetManager/AssetFamilyApi.php b/src/Api/AssetManager/AssetFamilyApi.php index 8a1e3c65..2712ef82 100644 --- a/src/Api/AssetManager/AssetFamilyApi.php +++ b/src/Api/AssetManager/AssetFamilyApi.php @@ -8,6 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; class AssetFamilyApi implements AssetFamilyApiInterface { @@ -54,4 +55,12 @@ public function upsert(string $code, array $data = []): int { return $this->resourceClient->upsertResource(static::ASSET_FAMILY_URI, [$code], $data); } + + /** + * {@inheritdoc} + */ + public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::ASSET_FAMILY_URI, [$code], $data, $onSuccess, $onFail); + } } diff --git a/src/Api/AssetManager/AssetFamilyApiInterface.php b/src/Api/AssetManager/AssetFamilyApiInterface.php index e892f909..ecea3583 100644 --- a/src/Api/AssetManager/AssetFamilyApiInterface.php +++ b/src/Api/AssetManager/AssetFamilyApiInterface.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; interface AssetFamilyApiInterface { @@ -32,4 +33,13 @@ public function all(array $queryParameters = []): ResourceCursorInterface; * Status code 204 indicating that the asset family has been well updated. */ public function upsert(string $assetFamilyCode, array $data = []): int; + + /** + * Creates an asset family if it does not exist yet, otherwise updates partially the asset family. + * + * @throws HttpException + * + * @return PromiseInterface + */ + public function upsertAsync(string $assetFamilyCode, array $data = []): PromiseInterface; } diff --git a/src/Api/AssetTagApi.php b/src/Api/AssetTagApi.php index 5749f3f2..e9068b41 100644 --- a/src/Api/AssetTagApi.php +++ b/src/Api/AssetTagApi.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; /** * API implementation to manage asset tags. @@ -71,4 +72,9 @@ public function listPerPage(int $limit = 100, bool $withCount = false, array $qu return $this->pageFactory->createPage($data); } + + public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::ASSET_TAG_URI, [$code], $data, $onSuccess, $onFail); + } } diff --git a/src/Api/AssociationTypeApi.php b/src/Api/AssociationTypeApi.php index 5447c24f..e889fee9 100644 --- a/src/Api/AssociationTypeApi.php +++ b/src/Api/AssociationTypeApi.php @@ -8,6 +8,8 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; +use Psr\Http\Message\StreamInterface; /** * @author Philippe Mossière @@ -75,6 +77,11 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSOCIATION_TYPE_URI, [$code], $data); } + public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::ASSOCIATION_TYPE_URI, [$code], $data, $onSuccess, $onFail); + } + /** * {@inheritdoc} */ @@ -82,4 +89,9 @@ public function upsertList($resources): \Traversable { return $this->resourceClient->upsertStreamResourceList(static::ASSOCIATION_TYPES_URI, [], $resources); } + + public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncStreamResourceList(static::ASSOCIATION_TYPES_URI, [], $resources, $onSuccess, $onFail); + } } diff --git a/src/Api/AttributeApi.php b/src/Api/AttributeApi.php index baab98f8..a6934f82 100644 --- a/src/Api/AttributeApi.php +++ b/src/Api/AttributeApi.php @@ -8,6 +8,8 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; +use Psr\Http\Message\StreamInterface; /** * API implementation to manage the attributes. @@ -78,6 +80,11 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ATTRIBUTE_URI, [$code], $data); } + public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_URI, [$code], $data, $onSuccess, $onFail); + } + /** * {@inheritdoc} */ @@ -85,4 +92,9 @@ public function upsertList($resources): \Traversable { return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTES_URI, [], $resources); } + + public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTES_URI, [], $resources, $onSuccess, $onFail); + } } diff --git a/src/Api/AttributeGroupApi.php b/src/Api/AttributeGroupApi.php index 78db2949..f7b76243 100644 --- a/src/Api/AttributeGroupApi.php +++ b/src/Api/AttributeGroupApi.php @@ -8,6 +8,8 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; +use Psr\Http\Message\StreamInterface; /** * API implementation to manage attribute groups. @@ -78,6 +80,11 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ATTRIBUTE_GROUP_URI, [$code], $data); } + public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_GROUP_URI, [$code], $data, $onSuccess, $onFail); + } + /** * {@inheritdoc} */ @@ -85,4 +92,9 @@ public function upsertList($resources): \Traversable { return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTE_GROUPS_URI, [], $resources); } + + public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTE_GROUPS_URI, [], $resources, $onSuccess, $onFail); + } } diff --git a/src/Api/AttributeOptionApi.php b/src/Api/AttributeOptionApi.php index fd61a6c1..152a2cfc 100644 --- a/src/Api/AttributeOptionApi.php +++ b/src/Api/AttributeOptionApi.php @@ -8,6 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; /** * API implementation to manage the attribute options. @@ -91,4 +92,14 @@ public function upsertList($attributeCode, $attributeOptions): \Traversable { return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions); } + + public function upsertAsyncList ($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions, $onSuccess, $onFail); + } + + public function upsertAsync ($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_OPTION_URI, [$attributeCode, $attributeOptionCode], $data, $onSuccess, $onFail); + } } diff --git a/src/Api/AttributeOptionApiInterface.php b/src/Api/AttributeOptionApiInterface.php index f8b9429a..fd7c906d 100644 --- a/src/Api/AttributeOptionApiInterface.php +++ b/src/Api/AttributeOptionApiInterface.php @@ -6,6 +6,8 @@ use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException; use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; +use Psr\Http\Message\StreamInterface; /** * API to manage the attribute options. @@ -86,6 +88,19 @@ public function create($attributeCode, $attributeOptionCode, array $data = []): */ public function upsert($attributeCode, $attributeOptionCode, array $data = []): int; + /** + * Creates an attribute option if it does not exist yet, otherwise updates partially the attribute option. + * + * @param string $attributeCode code of the attribute + * @param string $attributeOptionCode code of the attribute option to create or update + * @param array $data data of the attribute option to create or update + * + * @throws HttpException + * + * @return PromiseInterface + */ + public function upsertAsync($attributeCode, $attributeOptionCode, array $data = []): PromiseInterface; + /** * Updates or creates several attribute options at once. * @@ -97,4 +112,16 @@ public function upsert($attributeCode, $attributeOptionCode, array $data = []): * @return \Traversable returns an iterable object, each entry corresponding to the response of the upserted attribute options */ public function upsertList($attributeCode, $attributeOptions): \Traversable; + + /** + * Updates or creates several attribute options at once. + * + * @param string $attributeCode code of the attribute + * @param array|StreamInterface $attributeOptions array or StreamInterface object containing data of the attribute options to create or update + * + * @throws HttpException + * + * @return PromiseInterface + */ + public function upsertAsyncList($attributeCode, $attributeOptions): PromiseInterface; } diff --git a/src/Api/CategoryApi.php b/src/Api/CategoryApi.php index 95d9d524..45a4dd04 100644 --- a/src/Api/CategoryApi.php +++ b/src/Api/CategoryApi.php @@ -8,6 +8,8 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; +use Psr\Http\Message\StreamInterface; /** * API implementation to manage the categories. @@ -78,6 +80,11 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::CATEGORY_URI, [$code], $data); } + public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::CATEGORY_URI, [$code], $data, $onSuccess, $onFail); + } + /** * {@inheritdoc} */ @@ -85,4 +92,9 @@ public function upsertList($resources): \Traversable { return $this->resourceClient->upsertStreamResourceList(static::CATEGORIES_URI, [], $resources); } + + public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncStreamResourceList(static::CATEGORIES_URI, [], $resources, $onSuccess, $onFail); + } } diff --git a/src/Api/ChannelApi.php b/src/Api/ChannelApi.php index de885da9..0afc12d8 100644 --- a/src/Api/ChannelApi.php +++ b/src/Api/ChannelApi.php @@ -8,6 +8,8 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; +use Psr\Http\Message\StreamInterface; /** * API implementation to manage the channels. @@ -78,6 +80,11 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::CHANNEL_URI, [$code], $data); } + public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::CHANNEL_URI, [$code], $data, $onSuccess, $onFail); + } + /** * {@inheritdoc} */ @@ -85,4 +92,9 @@ public function upsertList($resources): \Traversable { return $this->resourceClient->upsertStreamResourceList(static::CHANNELS_URI, [], $resources); } + + public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncStreamResourceList(static::CHANNELS_URI, [], $resources, $onSuccess, $onFail); + } } diff --git a/src/Api/FamilyApi.php b/src/Api/FamilyApi.php index 4a82b1a0..de2cacd5 100644 --- a/src/Api/FamilyApi.php +++ b/src/Api/FamilyApi.php @@ -8,6 +8,8 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; +use Psr\Http\Message\StreamInterface; /** * API implementation to manage the families. @@ -78,6 +80,11 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::FAMILY_URI, [$code], $data); } + public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::FAMILY_URI, [$code], $data, $onSuccess, $onFail); + } + /** * {@inheritdoc} */ @@ -85,4 +92,9 @@ public function upsertList($resources): \Traversable { return $this->resourceClient->upsertStreamResourceList(static::FAMILIES_URI, [], $resources); } + + public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncStreamResourceList(static::FAMILIES_URI, [], $resources, $onSuccess, $onFail); + } } diff --git a/src/Api/FamilyVariantApi.php b/src/Api/FamilyVariantApi.php index 14917d23..e94755be 100644 --- a/src/Api/FamilyVariantApi.php +++ b/src/Api/FamilyVariantApi.php @@ -8,6 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; /** * Api implementation to manages Family Variants @@ -101,4 +102,22 @@ public function upsertList($familyCode, $familyVariants): \Traversable { return $this->resourceClient->upsertStreamResourceList(static::FAMILY_VARIANTS_URI, [$familyCode], $familyVariants); } + + public function upsertAsync($familyCode, $familyVariantCode, array $data = []): PromiseInterface + { + if (array_key_exists('family', $data)) { + throw new InvalidArgumentException('The parameter "family" must not be defined in the data parameter'); + } + if (array_key_exists('code', $data)) { + throw new InvalidArgumentException('The parameter "code" must not be defined in the data parameter'); + } + $data['code'] = $familyVariantCode; + + return $this->resourceClient->upsertAsyncResource(static::FAMILY_VARIANT_URI, [$familyCode, $familyVariantCode], $data); + } + + public function upsertAsyncList ($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncStreamResourceList(static::FAMILY_VARIANTS_URI, [$familyCode], $familyVariants, $onSuccess, $onFail); + } } diff --git a/src/Api/FamilyVariantApiInterface.php b/src/Api/FamilyVariantApiInterface.php index 77f59b15..05f0d4a3 100644 --- a/src/Api/FamilyVariantApiInterface.php +++ b/src/Api/FamilyVariantApiInterface.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException; use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -61,6 +62,21 @@ public function create($familyCode, $familyVariantCode, array $data = []): int; */ public function upsert($familyCode, $familyVariantCode, array $data = []): int; + /** + * Available since Akeneo PIM 2.0. + * Creates a family variant if it does not exist yet, otherwise updates it partially. + * + * @param string $familyCode code of the family parent of the family variant to create or update + * @param string $familyVariantCode code of the family variant to create or update + * @param array $data data of the family variant to create or update + * + * @throws HttpException If the request failed. + * @throws InvalidArgumentException If the parameter "familyCode" is defined in the data parameter. + * + * @return PromiseInterface + */ + public function upsertAsync($familyCode, $familyVariantCode, array $data = []): PromiseInterface; + /** * Available since Akeneo PIM 2.0. * Gets a list of family variants by returning the first page. @@ -106,4 +122,17 @@ public function all($familyCode, $pageSize = 10, array $queryParameters = []): R * @return \Traversable returns an iterable object, each entry corresponding to the response of the upserted resource */ public function upsertList($familyCode, $familyVariants): \Traversable; + + /** + * Available since Akeneo PIM 2.0. + * Updates or creates several resources. + * + * @param string $familyCode code of the family parent of family variants to create or update + * @param array|StreamInterface $familyVariants array or StreamInterface object containing the family variants to create or update + * + * @throws HttpException + * + * @return PromiseInterface + */ + public function upsertAsyncList($familyCode, $familyVariants): PromiseInterface; } diff --git a/src/Api/Operation/UpsertableResourceInterface.php b/src/Api/Operation/UpsertableResourceInterface.php index ab03e36b..1cebce3a 100644 --- a/src/Api/Operation/UpsertableResourceInterface.php +++ b/src/Api/Operation/UpsertableResourceInterface.php @@ -3,6 +3,7 @@ namespace Akeneo\Pim\ApiClient\Api\Operation; use Akeneo\Pim\ApiClient\Exception\HttpException; +use GuzzleHttp\Promise\PromiseInterface; /** * API that can "upsert" a resource. @@ -25,4 +26,16 @@ interface UpsertableResourceInterface * Status code 204 indicating that the resource has been well updated. */ public function upsert(string $code, array $data = []): int; + + /** + * Creates a resource if it does not exist yet, otherwise updates partially the resource. + * + * @param string $code code of the resource to create or update + * @param array $data data of the resource to create or update + * + * @throws HttpException If the request failed. + * + * @return PromiseInterface + */ + public function upsertAsync(string $code, array $data = []): PromiseInterface; } diff --git a/src/Api/Operation/UpsertableResourceListInterface.php b/src/Api/Operation/UpsertableResourceListInterface.php index 0f19fae4..21bee47d 100644 --- a/src/Api/Operation/UpsertableResourceListInterface.php +++ b/src/Api/Operation/UpsertableResourceListInterface.php @@ -3,6 +3,7 @@ namespace Akeneo\Pim\ApiClient\Api\Operation; use Akeneo\Pim\ApiClient\Exception\HttpException; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -24,4 +25,15 @@ interface UpsertableResourceListInterface * @return \Traversable returns an iterable object, each entry corresponding to the response of the upserted resource */ public function upsertList(array|StreamInterface $resources): \Traversable; + + /** + * Updates or creates several resources. + * + * @param array|StreamInterface $resources array or StreamInterface object containing the resources to create or update + * + * @throws HttpException + * + * @return PromiseInterface returns a Promise + */ + public function upsertAsyncList(array|StreamInterface $resources): PromiseInterface; } diff --git a/src/Api/ProductApi.php b/src/Api/ProductApi.php index 7ea53680..ddaa06ee 100644 --- a/src/Api/ProductApi.php +++ b/src/Api/ProductApi.php @@ -8,6 +8,8 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; +use Psr\Http\Message\StreamInterface; /** * API implementation to manage the products. @@ -80,6 +82,11 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::PRODUCT_URI, [$code], $data); } + public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::PRODUCT_URI, [$code], $data, $onSuccess, $onFail); + } + /** * {@inheritdoc} */ @@ -95,4 +102,9 @@ public function upsertList($resources): \Traversable { return $this->resourceClient->upsertStreamResourceList(static::PRODUCTS_URI, [], $resources); } + + public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCTS_URI, [], $resources, $onSuccess, $onFail); + } } diff --git a/src/Api/ProductModelApi.php b/src/Api/ProductModelApi.php index 6c3e19ec..e837d339 100644 --- a/src/Api/ProductModelApi.php +++ b/src/Api/ProductModelApi.php @@ -8,6 +8,8 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; +use Psr\Http\Message\StreamInterface; /** * API implementation to manage the product models. @@ -113,4 +115,20 @@ public function delete(string $code): int { return $this->resourceClient->deleteResource(static::PRODUCT_MODEL_URI, [$code]); } + + public function upsertAsync(string $code, array $data = []): PromiseInterface + { + if (array_key_exists('code', $data)) { + throw new InvalidArgumentException('The parameter "code" must not be defined in the data parameter'); + } + + $data['code'] = $code; + + return $this->resourceClient->upsertAsyncResource(static::PRODUCT_MODEL_URI, [$code], $data); + } + + public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCT_MODELS_URI, [], $resources, $onSuccess, $onFail); + } } diff --git a/src/Api/ProductUuidApi.php b/src/Api/ProductUuidApi.php index 5a316cfe..65b333bb 100644 --- a/src/Api/ProductUuidApi.php +++ b/src/Api/ProductUuidApi.php @@ -10,6 +10,8 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; +use Psr\Http\Message\StreamInterface; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -63,6 +65,11 @@ public function upsert(string $uuid, array $data = []): int return $this->resourceClient->upsertResource(static::PRODUCT_UUID_URI, [$uuid], $data); } + public function upsertAsync (string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::PRODUCT_UUID_URI, [$uuid], $data, $onSuccess, $onFail); + } + public function delete(string $uuid): int { return $this->resourceClient->deleteResource(static::PRODUCT_UUID_URI, [$uuid]); @@ -72,4 +79,9 @@ public function upsertList($resources): \Traversable { return $this->resourceClient->upsertStreamResourceList(static::PRODUCTS_UUID_URI, [], $resources); } + + public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCTS_UUID_URI, [], $resources, $onSuccess, $onFail); + } } diff --git a/src/Api/ProductUuidApiInterface.php b/src/Api/ProductUuidApiInterface.php index 858e2dbf..195a86a4 100644 --- a/src/Api/ProductUuidApiInterface.php +++ b/src/Api/ProductUuidApiInterface.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Api\Operation\ListableResourceInterface; use Akeneo\Pim\ApiClient\Api\Operation\UpsertableResourceListInterface; +use GuzzleHttp\Promise\PromiseInterface; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -19,5 +20,7 @@ public function create(string $uuid, array $data = []): int; public function upsert(string $uuid, array $data = []): int; + public function upsertAsync(string $uuid, array $data = []): PromiseInterface; + public function delete(string $uuid): int; } diff --git a/src/Api/ReferenceEntityApi.php b/src/Api/ReferenceEntityApi.php index 11a440ed..b7c92b1c 100644 --- a/src/Api/ReferenceEntityApi.php +++ b/src/Api/ReferenceEntityApi.php @@ -8,6 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; /** * @author Tamara Robichet @@ -59,4 +60,9 @@ public function upsert(string $referenceEntityCode, array $data = []): int { return $this->resourceClient->upsertResource(static::REFERENCE_ENTITY_URI, [$referenceEntityCode], $data); } + + public function upsertAsync (string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_URI, [$referenceEntityCode], $data, $onSuccess, $onFail); + } } diff --git a/src/Api/ReferenceEntityApiInterface.php b/src/Api/ReferenceEntityApiInterface.php index 2e085ad2..f68cc201 100644 --- a/src/Api/ReferenceEntityApiInterface.php +++ b/src/Api/ReferenceEntityApiInterface.php @@ -6,9 +6,10 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; /** - * API to mange the reference entities. + * API to manage the reference entities. * * @author Tamara Robichet * @copyright 2018 Akeneo SAS (http://www.akeneo.com) @@ -50,4 +51,16 @@ public function all(array $queryParameters = []): ResourceCursorInterface; * Status code 204 indicating that the reference entity has been well updated. */ public function upsert(string $referenceEntityCode, array $data = []): int; + + /** + * Creates a reference entity if it does not exist yet, otherwise updates partially the reference entity. + * + * @param string $referenceEntityCode Code of the reference entity + * @param array $data Data of the reference entity to create or update + * + * @throws HttpException If the request failed. + * + * @return PromiseInterface + */ + public function upsertAsync(string $referenceEntityCode, array $data = []): PromiseInterface; } diff --git a/src/Api/ReferenceEntityAttributeApi.php b/src/Api/ReferenceEntityAttributeApi.php index b5e0819b..477eced6 100644 --- a/src/Api/ReferenceEntityAttributeApi.php +++ b/src/Api/ReferenceEntityAttributeApi.php @@ -5,6 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; +use GuzzleHttp\Promise\PromiseInterface; /** * @author Laurent Petard @@ -44,4 +45,12 @@ public function upsert(string $referenceEntityCode, string $attributeCode, array { return $this->resourceClient->upsertResource(static::REFERENCE_ENTITY_ATTRIBUTE_URI, [$referenceEntityCode, $attributeCode], $data); } + + /** + * {@inheritdoc} + */ + public function upsertAsync (string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_ATTRIBUTE_URI, [$referenceEntityCode, $attributeCode], $data, $onSuccess, $onFail); + } } diff --git a/src/Api/ReferenceEntityAttributeApiInterface.php b/src/Api/ReferenceEntityAttributeApiInterface.php index 04b7f117..fdfd931d 100644 --- a/src/Api/ReferenceEntityAttributeApiInterface.php +++ b/src/Api/ReferenceEntityAttributeApiInterface.php @@ -5,6 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Exception\HttpException; +use GuzzleHttp\Promise\PromiseInterface; /** * @author Laurent Petard @@ -50,4 +51,17 @@ public function all(string $referenceEntityCode, array $queryParameters = []): a * Status code 204 indicating that the reference entity attribute has been well updated. */ public function upsert(string $referenceEntityCode, string $attributeCode, array $data = []): int; + + /** + * Creates a reference entity attribute if it does not exist yet, otherwise updates partially the attribute. + * + * @param string $referenceEntityCode Code of the reference entity + * @param string $attributeCode Code of the attribute + * @param array $data Data of the attribute to create or update + * + * @throws HttpException If the request failed. + * + * @return PromiseInterface + */ + public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = []): PromiseInterface; } diff --git a/src/Api/ReferenceEntityAttributeOptionApi.php b/src/Api/ReferenceEntityAttributeOptionApi.php index 29729d13..c36bc94b 100644 --- a/src/Api/ReferenceEntityAttributeOptionApi.php +++ b/src/Api/ReferenceEntityAttributeOptionApi.php @@ -5,6 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; +use GuzzleHttp\Promise\PromiseInterface; /** * @author Laurent Petard @@ -54,4 +55,16 @@ public function upsert(string $referenceEntityCode, string $attributeCode, strin $data ); } + + /** + * {@inheritdoc} + */ + public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource( + static::REFERENCE_ENTITY_ATTRIBUTE_OPTION_URI, + [$referenceEntityCode, $attributeCode, $attributeOptionCode], + $data + ); + } } diff --git a/src/Api/ReferenceEntityAttributeOptionApiInterface.php b/src/Api/ReferenceEntityAttributeOptionApiInterface.php index 1b1c5f80..5c12c1ed 100644 --- a/src/Api/ReferenceEntityAttributeOptionApiInterface.php +++ b/src/Api/ReferenceEntityAttributeOptionApiInterface.php @@ -5,6 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Exception\HttpException; +use GuzzleHttp\Promise\PromiseInterface; /** * @author Laurent Petard @@ -52,4 +53,18 @@ public function all(string $referenceEntityCode, string $attributeCode): array; * Status code 204 indicating that the reference entity attribute option has been well updated. */ public function upsert(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = []): int; + + /** + * Creates a reference entity attribute option if it does not exist yet, otherwise updates partially the attribute option. + * + * @param string $referenceEntityCode Code of the reference entity + * @param string $attributeCode Code of the attribute + * @param string $attributeOptionCode Code of the attribute option + * @param array $data Data of the attribute option to create or update + * + * @throws HttpException If the request failed. + * + * @return PromiseInterface + */ + public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface; } diff --git a/src/Api/ReferenceEntityRecordApi.php b/src/Api/ReferenceEntityRecordApi.php index 95712961..bb6f80e5 100644 --- a/src/Api/ReferenceEntityRecordApi.php +++ b/src/Api/ReferenceEntityRecordApi.php @@ -8,6 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; /** * @author Laurent Petard @@ -67,4 +68,14 @@ public function upsertList(string $referenceEntityCode, array $records): array { return $this->resourceClient->upsertJsonResourceList(static::REFERENCE_ENTITY_RECORDS_URI, [$referenceEntityCode], $records); } + + public function upsertAsync (string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_RECORD_URI, [$referenceEntityCode, $recordCode], $data, $onSuccess, $onFail); + } + + public function upsertAsyncList (string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncJsonResourceList(static::REFERENCE_ENTITY_RECORDS_URI, [$referenceEntityCode], $records, $onSuccess, $onFail); + } } diff --git a/src/Api/ReferenceEntityRecordApiInterface.php b/src/Api/ReferenceEntityRecordApiInterface.php index f516050f..7946000f 100644 --- a/src/Api/ReferenceEntityRecordApiInterface.php +++ b/src/Api/ReferenceEntityRecordApiInterface.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; +use GuzzleHttp\Promise\PromiseInterface; /** * API to mange the reference entity records. @@ -54,6 +55,19 @@ public function all(string $referenceEntityCode, array $queryParameters = []): R */ public function upsert(string $referenceEntityCode, string $recordCode, array $data = []): int; + /** + * Creates a reference entity record if it does not exist yet, otherwise updates partially the record. + * + * @param string $referenceEntityCode Code of the reference entity + * @param string $recordCode Code of the record + * @param array $data Data of the record to create or update + * + * @throws HttpException If the request failed. + * + * @return PromiseInterface + */ + public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = []): PromiseInterface; + /** * Updates or creates several reference entity records. * @@ -65,4 +79,16 @@ public function upsert(string $referenceEntityCode, string $recordCode, array $d * @return array returns the list of the responses of each created or updated record. */ public function upsertList(string $referenceEntityCode, array $records): array; + + /** + * Updates or creates several reference entity records. + * + * @param string $referenceEntityCode Code of the reference entity + * @param array $records Array containing the records to create or update + * + * @throws HttpException + * + * @return PromiseInterface + */ + public function upsertAsyncList(string $referenceEntityCode, array $records): PromiseInterface; } diff --git a/src/Client/AuthenticatedHttpClient.php b/src/Client/AuthenticatedHttpClient.php index 1232e648..139d3d08 100644 --- a/src/Client/AuthenticatedHttpClient.php +++ b/src/Client/AuthenticatedHttpClient.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\UnauthorizedHttpException; use Akeneo\Pim\ApiClient\Exception\UnprocessableEntityHttpException; use Akeneo\Pim\ApiClient\Security\Authentication; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\ResponseInterface; /** @@ -76,4 +77,40 @@ private function renewTokens(UnauthorizedHttpException $unauthorizedHttpExceptio throw $unauthorizedHttpException; } } + + public function sendAsync( + string $httpMethod, + $uri, + array $headers = [], + $body = null, + callable $onSuccess = null, + callable $onFail = null): PromiseInterface + { + if (null === $this->authentication->getAccessToken()) { + $tokens = $this->authenticationApi->authenticateByPassword( + $this->authentication->getClientId(), + $this->authentication->getSecret(), + $this->authentication->getUsername(), + $this->authentication->getPassword() + ); + + $this->authentication + ->setAccessToken($tokens['access_token']) + ->setRefreshToken($tokens['refresh_token']); + } + + try { + $headers['Authorization'] = sprintf('Bearer %s', $this->authentication->getAccessToken()); + return $this->basicHttpClient->sendAsync($httpMethod, $uri, $headers, $body, $onSuccess, $onFail); + } catch (UnauthorizedHttpException $e) { + $tokens = $this->renewTokens($e); + + $this->authentication + ->setAccessToken($tokens['access_token']) + ->setRefreshToken($tokens['refresh_token']); + + $headers['Authorization'] = sprintf('Bearer %s', $this->authentication->getAccessToken()); + return $this->basicHttpClient->sendAsync($httpMethod, $uri, $headers, $body, $onSuccess, $onFail); + } + } } diff --git a/src/Client/CachedResourceClient.php b/src/Client/CachedResourceClient.php index 906adab9..366a409b 100644 --- a/src/Client/CachedResourceClient.php +++ b/src/Client/CachedResourceClient.php @@ -5,6 +5,7 @@ namespace Akeneo\Pim\ApiClient\Client; use Akeneo\Pim\ApiClient\Cache\CacheInterface; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\ResponseInterface; /** @@ -73,6 +74,16 @@ public function upsertResource(string $uri, array $uriParameters = [], array $bo return $this->resourceClient->upsertResource($uri, $uriParameters, $body); } + public function upsertAsyncResource( + string $uri, + array $uriParameters = [], + array $body = [], + callable $onSuccess = null, + callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncResource($uri, $uriParameters, $body, $onSuccess, $onFail); + } + /** * {@inheritdoc} */ @@ -81,6 +92,16 @@ public function upsertStreamResourceList(string $uri, array $uriParameters = [], return $this->resourceClient->upsertStreamResourceList($uri, $uriParameters, $resources); } + public function upsertAsyncStreamResourceList( + string $uri, + array $uriParameters = [], + $resources = [], + callable $onSuccess = null, + callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncStreamResourceList($uri, $uriParameters, $resources, $onSuccess, $onFail); + } + /** * {@inheritdoc} */ @@ -89,6 +110,16 @@ public function upsertJsonResourceList(string $uri, array $uriParameters = [], a return $this->resourceClient->upsertJsonResourceList($uri, $uriParameters, $resources); } + public function upsertAsyncJsonResourceList( + string $uri, + array $uriParameters = [], + array $resources = [], + callable $onSuccess = null, + callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncJsonResourceList($uri, $uriParameters, $resources, $onSuccess, $onFail); + } + /** * {@inheritdoc} */ @@ -120,4 +151,14 @@ public function upsertAndReturnResource(string $uri, array $uriParameters = [], { return $this->resourceClient->upsertAndReturnResource($uri, $uriParameters, $body); } + + public function upsertAsyncAndReturnPromise( + string $uri, + array $uriParameters = [], + array $body = [], + callable $onSuccess = null, + callable $onFail = null): PromiseInterface + { + return $this->resourceClient->upsertAsyncAndReturnPromise($uri, $uriParameters, $body, $onSuccess, $onFail); + } } diff --git a/src/Client/ClientInterface.php b/src/Client/ClientInterface.php new file mode 100644 index 00000000..32e8c8aa --- /dev/null +++ b/src/Client/ClientInterface.php @@ -0,0 +1,14 @@ +httpExceptionHandler = new HttpExceptionHandler(); } - /** - * {@inheritdoc} - */ - public function sendRequest(string $httpMethod, $uri, array $headers = [], $body = null): ResponseInterface + private function prepareRequest(string $httpMethod, $uri, array $headers = [], $body = null): RequestInterface { $request = $this->requestFactory->createRequest($httpMethod, $uri); @@ -64,8 +62,31 @@ public function sendRequest(string $httpMethod, $uri, array $headers = [], $body } } + return $request; + } + + /** + * {@inheritdoc} + */ + public function sendRequest(string $httpMethod, $uri, array $headers = [], $body = null): ResponseInterface + { + $request = $this->prepareRequest($httpMethod, $uri, $headers, $body); + $response = $this->httpClient->sendRequest($request); return $this->httpExceptionHandler->transformResponseToException($request, $response); } + + public function sendAsync( + string $httpMethod, + $uri, + array $headers = [], + $body = null, + callable $onSuccess = null, + callable $onFail = null): PromiseInterface + { + $request = $this->prepareRequest($httpMethod, $uri, $headers, $body); + + return $this->httpClient->sendAsync($request)->then($onSuccess, $onFail); + } } diff --git a/src/Client/HttpClientInterface.php b/src/Client/HttpClientInterface.php index c67761df..c103c218 100644 --- a/src/Client/HttpClientInterface.php +++ b/src/Client/HttpClientInterface.php @@ -3,6 +3,7 @@ namespace Akeneo\Pim\ApiClient\Client; use Akeneo\Pim\ApiClient\Exception\HttpException; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; use Psr\Http\Message\UriInterface; @@ -29,4 +30,26 @@ interface HttpClientInterface * @return ResponseInterface */ public function sendRequest(string $httpMethod, $uri, array $headers = [], $body = null): ResponseInterface; + + /** + * Sends a request. + * + * @param string $httpMethod HTTP method to use + * @param string|UriInterface $uri URI of the request + * @param array $headers headers of the request + * @param string|StreamInterface|null $body body of the request + * @param ?callable $onSuccess Callback in case of success + * @param ?callable $onFail Callback in case of fail + * + * @throws HttpException If the request failed. + * + * @return PromiseInterface + */ + public function sendAsync( + string $httpMethod, + $uri, + array $headers = [], + $body = null, + callable $onSuccess = null, + callable $onFail = null): PromiseInterface; } diff --git a/src/Client/ResourceClient.php b/src/Client/ResourceClient.php index 7d56f530..f4b94c5f 100644 --- a/src/Client/ResourceClient.php +++ b/src/Client/ResourceClient.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Routing\UriGeneratorInterface; use Akeneo\Pim\ApiClient\Stream\MultipartStreamBuilderFactory; use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponseFactory; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; @@ -124,6 +125,16 @@ public function upsertResource(string $uri, array $uriParameters = [], array $bo return $response->getStatusCode(); } + public function upsertAsyncResource( + string $uri, + array $uriParameters = [], + array $body = [], + callable $onSuccess = null, + callable $onFail = null): PromiseInterface + { + return $this->sendAsyncUpsertRequest($uri, $uriParameters, $body, $onSuccess, $onFail); + } + /** * {@inheritdoc} */ @@ -134,10 +145,17 @@ public function upsertAndReturnResource(string $uri, array $uriParameters = [], return json_decode($response->getBody()->getContents(), true); } - /** - * {@inheritdoc} - */ - public function upsertStreamResourceList(string $uri, array $uriParameters = [], $resources = []): \Traversable + public function upsertAsyncAndReturnPromise( + string $uri, + array $uriParameters = [], + array $body = [], + callable $onSuccess = null, + callable $onFail = null): PromiseInterface + { + return $this->sendAsyncUpsertRequest($uri, $uriParameters, $body, $onSuccess, $onFail); + } + + public function prepareResourceListRequest(array $resources): string { if (!is_array($resources) && !$resources instanceof StreamInterface) { throw new InvalidArgumentException('The parameter "resources" must be an array or an instance of StreamInterface.'); @@ -158,6 +176,15 @@ public function upsertStreamResourceList(string $uri, array $uriParameters = [], $body = $resources; } + return $body; + } + + /** + * {@inheritdoc} + */ + public function upsertStreamResourceList(string $uri, array $uriParameters = [], $resources = []): \Traversable + { + $body = $this->prepareResourceListRequest($resources); $uri = $this->uriGenerator->generate($uri, $uriParameters); $response = $this->httpClient->sendRequest( 'PATCH', @@ -169,6 +196,25 @@ public function upsertStreamResourceList(string $uri, array $uriParameters = [], return $this->upsertListResponseFactory->create($response->getBody()); } + public function upsertAsyncStreamResourceList( + string $uri, + array $uriParameters = [], + $resources = [], + callable $onSuccess = null, + callable $onFail = null): PromiseInterface + { + $body = $this->prepareResourceListRequest($resources); + $uri = $this->uriGenerator->generate($uri, $uriParameters); + return $this->httpClient->sendAsync( + 'PATCH', + $uri, + ['Content-Type' => 'application/vnd.akeneo.collection+json'], + $body, + $onSuccess, + $onFail + ); + } + /** * {@inheritdoc} */ @@ -190,6 +236,24 @@ public function upsertJsonResourceList(string $uri, array $uriParameters = [], a return $response; } + public function upsertAsyncJsonResourceList( + string $uri, + array $uriParameters = [], + array $resources = [], + callable $onSuccess = null, + callable $onFail = null): PromiseInterface + { + $uri = $this->uriGenerator->generate($uri, $uriParameters); + return $this->httpClient->sendAsync( + 'PATCH', + $uri, + ['Content-Type' => 'application/json'], + json_encode($resources), + $onSuccess, + $onFail + ); + } + /** * {@inheritdoc} */ @@ -239,4 +303,25 @@ private function sendUpsertRequest(string $uri, array $uriParameters = [], array json_encode($body) ); } + + private function sendAsyncUpsertRequest( + string $uri, + array $uriParameters = [], + array $body = [], + callable $onSuccess = null, + callable $onFail = null): PromiseInterface + { + unset($body['_links']); + + $uri = $this->uriGenerator->generate($uri, $uriParameters); + + return $this->httpClient->sendAsync( + 'PATCH', + $uri, + ['Content-Type' => 'application/json'], + json_encode($body), + $onSuccess, + $onFail + ); + } } diff --git a/src/Client/ResourceClientInterface.php b/src/Client/ResourceClientInterface.php index 4cdd408e..e4c472ef 100644 --- a/src/Client/ResourceClientInterface.php +++ b/src/Client/ResourceClientInterface.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; @@ -109,6 +110,26 @@ public function createMultipartResource(string $uri, array $uriParameters = [], */ public function upsertResource(string $uri, array $uriParameters = [], array $body = []): int; + /** + * Creates a resource if it does not exist yet, otherwise updates partially the resource. + * + * @param string $uri URI of the resource + * @param array $uriParameters URI parameters of the resource + * @param array $body Body of the request + * @param ?callable $onSuccess Callback in case of success + * @param ?callable $onFail Callback in case of fail + * + * @throws HttpException If the request failed. + * + * @return PromiseInterface + */ + public function upsertAsyncResource( + string $uri, + array $uriParameters = [], + array $body = [], + callable $onSuccess = null, + callable $onFail = null): PromiseInterface; + /** * Creates and returns a resource if it does not exist yet, otherwise updates partially and returns the resource. * @@ -121,6 +142,25 @@ public function upsertResource(string $uri, array $uriParameters = [], array $bo */ public function upsertAndReturnResource(string $uri, array $uriParameters = [], array $body = []): array; + /** + * Creates and returns a resource if it does not exist yet, otherwise updates partially and returns the resource. + * + * @param string $uri URI of the resource + * @param array $uriParameters URI parameters of the resource + * @param array $body Body of the request + * @param ?callable $onSuccess Callback in case of success + * @param ?callable $onFail Callback in case of fail + * + * @throws HttpException If the request failed. + * + */ + public function upsertAsyncAndReturnPromise( + string $uri, + array $uriParameters = [], + array $body = [], + callable $onSuccess = null, + callable $onFail = null): PromiseInterface; + /** * Updates or creates several resources using a stream for the request and the response. * @@ -136,6 +176,28 @@ public function upsertAndReturnResource(string $uri, array $uriParameters = [], */ public function upsertStreamResourceList(string $uri, array $uriParameters = [], $resources = []): \Traversable; + /** + * Updates or creates several resources using a stream for the request and the response. + * + * @param string $uri URI of the resource + * @param array $uriParameters URI parameters of the resource + * @param array|StreamInterface $resources array of resources to create or update. + * You can pass your own StreamInterface implementation as well. + * @param ?callable $onSuccess Callback in case of success + * @param ?callable $onFail Callback in case of fail + * + * @throws HttpException If the request failed. + * @throws InvalidArgumentException If the resources or any part thereof are invalid. + * + * @return PromiseInterface returns a Promise + */ + public function upsertAsyncStreamResourceList( + string $uri, + array $uriParameters = [], + $resources = [], + callable $onSuccess = null, + callable $onFail = null): PromiseInterface; + /** * Updates or creates several resources using a single JSON string for the request and the response. * @@ -150,6 +212,27 @@ public function upsertStreamResourceList(string $uri, array $uriParameters = [], */ public function upsertJsonResourceList(string $uri, array $uriParameters = [], array $resources = []): array; + /** + * Updates or creates several resources using a single JSON string for the request and the response. + * + * @param string $uri URI of the resource + * @param array $uriParameters URI parameters of the resource + * @param array $resources array of resources to create or update. + * @param ?callable $onSuccess Callback in case of success + * @param ?callable $onFail Callback in case of fail + * + * @throws HttpException If the request failed. + * @throws InvalidArgumentException If the resources or any part thereof are invalid. + * + * @return PromiseInterface + */ + public function upsertAsyncJsonResourceList( + string $uri, + array $uriParameters = [], + array $resources = [], + callable $onSuccess = null, + callable $onFail = null): PromiseInterface; + /** * Deletes a resource. * diff --git a/src/Stream/UpsertResourceListResponse.php b/src/Stream/UpsertResourceListResponse.php index cfba42c7..a2b0885e 100644 --- a/src/Stream/UpsertResourceListResponse.php +++ b/src/Stream/UpsertResourceListResponse.php @@ -33,7 +33,7 @@ public function __construct( /** * {@inheritdoc} */ - public function current() + public function current(): array { return json_decode($this->line, true); } @@ -41,7 +41,7 @@ public function current() /** * {@inheritdoc} */ - public function next() + public function next(): void { $this->line = $this->streamReader->getNextLine($this->bodyStream); $this->lineNumber++; @@ -50,7 +50,7 @@ public function next() /** * {@inheritdoc} */ - public function key() + public function key(): int { return $this->lineNumber; } @@ -58,7 +58,7 @@ public function key() /** * {@inheritdoc} */ - public function valid() + public function valid(): bool { return null !== $this->line; } @@ -66,7 +66,7 @@ public function valid() /** * {@inheritdoc} */ - public function rewind() + public function rewind(): void { $this->bodyStream->rewind(); $this->lineNumber = 1; From 919fd8b44197f56aa8deef921a196bafd3ae2b61 Mon Sep 17 00:00:00 2001 From: gwendalaubert Date: Thu, 22 Jun 2023 17:07:57 +0200 Subject: [PATCH 02/10] DX-104 : Adding asynchronous requests to client api / Interfaces --- src/Api/AssetManager/AssetApiInterface.php | 4 ++-- src/Api/AssetManager/AssetAttributeApiInterface.php | 2 +- src/Api/AssetManager/AssetAttributeOptionApiInterface.php | 2 +- src/Api/AssetManager/AssetFamilyApiInterface.php | 2 +- src/Api/AttributeOptionApiInterface.php | 4 ++-- src/Api/FamilyVariantApiInterface.php | 4 ++-- src/Api/Operation/UpsertableResourceInterface.php | 2 +- src/Api/Operation/UpsertableResourceListInterface.php | 2 +- src/Api/ProductUuidApiInterface.php | 2 +- src/Api/ReferenceEntityApiInterface.php | 2 +- src/Api/ReferenceEntityAttributeApiInterface.php | 2 +- src/Api/ReferenceEntityAttributeOptionApiInterface.php | 2 +- src/Api/ReferenceEntityRecordApiInterface.php | 4 ++-- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Api/AssetManager/AssetApiInterface.php b/src/Api/AssetManager/AssetApiInterface.php index 589a0bb7..5108bb24 100644 --- a/src/Api/AssetManager/AssetApiInterface.php +++ b/src/Api/AssetManager/AssetApiInterface.php @@ -64,7 +64,7 @@ public function upsertList(string $assetFamilyCode, array $assets): array; * * @return PromiseInterface */ - public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = []): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; /** * Updates or creates several assets. @@ -76,7 +76,7 @@ public function upsertAsync(string $assetFamilyCode, string $assetCode, array $d * * @return PromiseInterface */ - public function upsertAsyncList(string $assetFamilyCode, array $assets): PromiseInterface; + public function upsertAsyncList(string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): PromiseInterface; /** * Deletes an asset. diff --git a/src/Api/AssetManager/AssetAttributeApiInterface.php b/src/Api/AssetManager/AssetAttributeApiInterface.php index 3b6d9563..547efaff 100644 --- a/src/Api/AssetManager/AssetAttributeApiInterface.php +++ b/src/Api/AssetManager/AssetAttributeApiInterface.php @@ -40,5 +40,5 @@ public function upsert(string $assetFamilyCode, string $attributeCode, array $da * * @return PromiseInterface */ - public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = []): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/AssetManager/AssetAttributeOptionApiInterface.php b/src/Api/AssetManager/AssetAttributeOptionApiInterface.php index f77bd4df..04caf4b9 100644 --- a/src/Api/AssetManager/AssetAttributeOptionApiInterface.php +++ b/src/Api/AssetManager/AssetAttributeOptionApiInterface.php @@ -40,5 +40,5 @@ public function upsert(string $assetFamilyCode, string $attributeCode, string $a * * @return PromiseInterface */ - public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/AssetManager/AssetFamilyApiInterface.php b/src/Api/AssetManager/AssetFamilyApiInterface.php index ecea3583..c5ffa482 100644 --- a/src/Api/AssetManager/AssetFamilyApiInterface.php +++ b/src/Api/AssetManager/AssetFamilyApiInterface.php @@ -41,5 +41,5 @@ public function upsert(string $assetFamilyCode, array $data = []): int; * * @return PromiseInterface */ - public function upsertAsync(string $assetFamilyCode, array $data = []): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/AttributeOptionApiInterface.php b/src/Api/AttributeOptionApiInterface.php index fd7c906d..9121fdb2 100644 --- a/src/Api/AttributeOptionApiInterface.php +++ b/src/Api/AttributeOptionApiInterface.php @@ -99,7 +99,7 @@ public function upsert($attributeCode, $attributeOptionCode, array $data = []): * * @return PromiseInterface */ - public function upsertAsync($attributeCode, $attributeOptionCode, array $data = []): PromiseInterface; + public function upsertAsync($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; /** * Updates or creates several attribute options at once. @@ -123,5 +123,5 @@ public function upsertList($attributeCode, $attributeOptions): \Traversable; * * @return PromiseInterface */ - public function upsertAsyncList($attributeCode, $attributeOptions): PromiseInterface; + public function upsertAsyncList($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/FamilyVariantApiInterface.php b/src/Api/FamilyVariantApiInterface.php index 05f0d4a3..e7daf9e6 100644 --- a/src/Api/FamilyVariantApiInterface.php +++ b/src/Api/FamilyVariantApiInterface.php @@ -75,7 +75,7 @@ public function upsert($familyCode, $familyVariantCode, array $data = []): int; * * @return PromiseInterface */ - public function upsertAsync($familyCode, $familyVariantCode, array $data = []): PromiseInterface; + public function upsertAsync($familyCode, $familyVariantCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; /** * Available since Akeneo PIM 2.0. @@ -134,5 +134,5 @@ public function upsertList($familyCode, $familyVariants): \Traversable; * * @return PromiseInterface */ - public function upsertAsyncList($familyCode, $familyVariants): PromiseInterface; + public function upsertAsyncList($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/Operation/UpsertableResourceInterface.php b/src/Api/Operation/UpsertableResourceInterface.php index 1cebce3a..d89e1fa3 100644 --- a/src/Api/Operation/UpsertableResourceInterface.php +++ b/src/Api/Operation/UpsertableResourceInterface.php @@ -37,5 +37,5 @@ public function upsert(string $code, array $data = []): int; * * @return PromiseInterface */ - public function upsertAsync(string $code, array $data = []): PromiseInterface; + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/Operation/UpsertableResourceListInterface.php b/src/Api/Operation/UpsertableResourceListInterface.php index 21bee47d..3bdb9199 100644 --- a/src/Api/Operation/UpsertableResourceListInterface.php +++ b/src/Api/Operation/UpsertableResourceListInterface.php @@ -35,5 +35,5 @@ public function upsertList(array|StreamInterface $resources): \Traversable; * * @return PromiseInterface returns a Promise */ - public function upsertAsyncList(array|StreamInterface $resources): PromiseInterface; + public function upsertAsync(array|StreamInterface $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/ProductUuidApiInterface.php b/src/Api/ProductUuidApiInterface.php index 195a86a4..f69d8f1d 100644 --- a/src/Api/ProductUuidApiInterface.php +++ b/src/Api/ProductUuidApiInterface.php @@ -20,7 +20,7 @@ public function create(string $uuid, array $data = []): int; public function upsert(string $uuid, array $data = []): int; - public function upsertAsync(string $uuid, array $data = []): PromiseInterface; + public function upsertAsync(string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; public function delete(string $uuid): int; } diff --git a/src/Api/ReferenceEntityApiInterface.php b/src/Api/ReferenceEntityApiInterface.php index f68cc201..0615262f 100644 --- a/src/Api/ReferenceEntityApiInterface.php +++ b/src/Api/ReferenceEntityApiInterface.php @@ -62,5 +62,5 @@ public function upsert(string $referenceEntityCode, array $data = []): int; * * @return PromiseInterface */ - public function upsertAsync(string $referenceEntityCode, array $data = []): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/ReferenceEntityAttributeApiInterface.php b/src/Api/ReferenceEntityAttributeApiInterface.php index fdfd931d..dc5fa690 100644 --- a/src/Api/ReferenceEntityAttributeApiInterface.php +++ b/src/Api/ReferenceEntityAttributeApiInterface.php @@ -63,5 +63,5 @@ public function upsert(string $referenceEntityCode, string $attributeCode, array * * @return PromiseInterface */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = []): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/ReferenceEntityAttributeOptionApiInterface.php b/src/Api/ReferenceEntityAttributeOptionApiInterface.php index 5c12c1ed..2eed7f18 100644 --- a/src/Api/ReferenceEntityAttributeOptionApiInterface.php +++ b/src/Api/ReferenceEntityAttributeOptionApiInterface.php @@ -66,5 +66,5 @@ public function upsert(string $referenceEntityCode, string $attributeCode, strin * * @return PromiseInterface */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/ReferenceEntityRecordApiInterface.php b/src/Api/ReferenceEntityRecordApiInterface.php index 7946000f..cb95eb90 100644 --- a/src/Api/ReferenceEntityRecordApiInterface.php +++ b/src/Api/ReferenceEntityRecordApiInterface.php @@ -66,7 +66,7 @@ public function upsert(string $referenceEntityCode, string $recordCode, array $d * * @return PromiseInterface */ - public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = []): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; /** * Updates or creates several reference entity records. @@ -90,5 +90,5 @@ public function upsertList(string $referenceEntityCode, array $records): array; * * @return PromiseInterface */ - public function upsertAsyncList(string $referenceEntityCode, array $records): PromiseInterface; + public function upsertAsyncList(string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): PromiseInterface; } From 3f0ec97301bbb1aebddb5853b4eb7b963d482082 Mon Sep 17 00:00:00 2001 From: gwendalaubert Date: Mon, 26 Jun 2023 11:19:44 +0200 Subject: [PATCH 03/10] DX-25 : Deleting tests --- src/AkeneoPimClientBuilder.php | 4 ++-- src/Api/AppCatalog/AppCatalogApi.php | 4 ++-- src/Api/AppCatalog/AppCatalogApiInterface.php | 4 ++-- src/Api/AssetApi.php | 6 +++--- src/Api/AssetCategoryApi.php | 6 +++--- src/Api/AssetManager/AssetApi.php | 6 +++--- src/Api/AssetManager/AssetApiInterface.php | 10 +++++----- src/Api/AssetManager/AssetAttributeApi.php | 4 ++-- .../AssetManager/AssetAttributeApiInterface.php | 6 +++--- src/Api/AssetManager/AssetAttributeOptionApi.php | 4 ++-- .../AssetAttributeOptionApiInterface.php | 6 +++--- src/Api/AssetManager/AssetFamilyApi.php | 4 ++-- src/Api/AssetManager/AssetFamilyApiInterface.php | 6 +++--- src/Api/AssetTagApi.php | 4 ++-- src/Api/AssociationTypeApi.php | 6 +++--- src/Api/AttributeApi.php | 6 +++--- src/Api/AttributeGroupApi.php | 6 +++--- src/Api/AttributeOptionApi.php | 6 +++--- src/Api/AttributeOptionApiInterface.php | 10 +++++----- src/Api/CategoryApi.php | 6 +++--- src/Api/ChannelApi.php | 6 +++--- src/Api/FamilyApi.php | 6 +++--- src/Api/FamilyVariantApi.php | 12 +++++++++--- src/Api/FamilyVariantApiInterface.php | 10 +++++----- .../Operation/UpsertableResourceInterface.php | 6 +++--- .../UpsertableResourceListInterface.php | 6 +++--- src/Api/ProductApi.php | 6 +++--- src/Api/ProductModelApi.php | 6 +++--- src/Api/ProductUuidApi.php | 6 +++--- src/Api/ProductUuidApiInterface.php | 4 ++-- src/Api/ReferenceEntityApi.php | 4 ++-- src/Api/ReferenceEntityApiInterface.php | 6 +++--- src/Api/ReferenceEntityAttributeApi.php | 4 ++-- src/Api/ReferenceEntityAttributeApiInterface.php | 6 +++--- src/Api/ReferenceEntityAttributeOptionApi.php | 4 ++-- ...eferenceEntityAttributeOptionApiInterface.php | 6 +++--- src/Api/ReferenceEntityRecordApi.php | 6 +++--- src/Api/ReferenceEntityRecordApiInterface.php | 10 +++++----- src/Client/AuthenticatedHttpClient.php | 4 ++-- src/Client/CachedResourceClient.php | 10 +++++----- src/Client/ClientInterface.php | 4 ++-- src/Client/HttpClient.php | 8 ++++---- src/Client/HttpClientInterface.php | 6 +++--- src/Client/ResourceClient.php | 14 +++++++------- src/Client/ResourceClientInterface.php | 16 ++++++++-------- tests/Api/UpsertListProductTest.php | 1 + 46 files changed, 149 insertions(+), 142 deletions(-) diff --git a/src/AkeneoPimClientBuilder.php b/src/AkeneoPimClientBuilder.php index febc4d68..b302a919 100644 --- a/src/AkeneoPimClientBuilder.php +++ b/src/AkeneoPimClientBuilder.php @@ -46,6 +46,7 @@ use Akeneo\Pim\ApiClient\Client\CachedResourceClient; use Akeneo\Pim\ApiClient\Client\HttpClient; use Akeneo\Pim\ApiClient\Client\Options; +use Akeneo\Pim\ApiClient\Client\ClientInterface; use Akeneo\Pim\ApiClient\Client\ResourceClient; use Akeneo\Pim\ApiClient\FileSystem\FileSystemInterface; use Akeneo\Pim\ApiClient\FileSystem\LocalFileSystem; @@ -57,7 +58,6 @@ use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponseFactory; use Http\Discovery\Psr17FactoryDiscovery; use Http\Discovery\Psr18ClientDiscovery; -use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestFactoryInterface; use Psr\Http\Message\StreamFactoryInterface; @@ -295,7 +295,7 @@ protected function setUp(Authentication $authentication): array return [$resourceClient, $pageFactory, $cursorFactory, $fileSystem]; } - private function getHttpClient(): ClientInterface + private function getHttpClient(): ClientInterface|\Psr\Http\Client\ClientInterface { if (null === $this->httpClient) { $this->httpClient = Psr18ClientDiscovery::find(); diff --git a/src/Api/AppCatalog/AppCatalogApi.php b/src/Api/AppCatalog/AppCatalogApi.php index 93d9d188..07abfb9f 100644 --- a/src/Api/AppCatalog/AppCatalogApi.php +++ b/src/Api/AppCatalog/AppCatalogApi.php @@ -10,7 +10,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -62,7 +62,7 @@ public function delete(string $code): int return $this->resourceClient->deleteResource(static::APP_CATALOG_URI, [$code]); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncAndReturnPromise(static::APP_CATALOG_URI, [$code], $data, $onSuccess, $onFail); } diff --git a/src/Api/AppCatalog/AppCatalogApiInterface.php b/src/Api/AppCatalog/AppCatalogApiInterface.php index 756e064a..7204d3eb 100644 --- a/src/Api/AppCatalog/AppCatalogApiInterface.php +++ b/src/Api/AppCatalog/AppCatalogApiInterface.php @@ -7,7 +7,7 @@ use Akeneo\Pim\ApiClient\Api\Operation\DeletableResourceInterface; use Akeneo\Pim\ApiClient\Api\Operation\GettableResourceInterface; use Akeneo\Pim\ApiClient\Api\Operation\ListableResourceInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -21,5 +21,5 @@ interface AppCatalogApiInterface extends public function create(array $data): array; public function upsert(string $code, array $data = []): array; - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/AssetApi.php b/src/Api/AssetApi.php index dd2a42af..eb1a872f 100644 --- a/src/Api/AssetApi.php +++ b/src/Api/AssetApi.php @@ -10,7 +10,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -91,7 +91,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSET_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_URI, [$code], $data, $onSuccess, $onFail); } @@ -104,7 +104,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ASSETS_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(self::ASSETS_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/AssetCategoryApi.php b/src/Api/AssetCategoryApi.php index 23e2534f..03c4958d 100644 --- a/src/Api/AssetCategoryApi.php +++ b/src/Api/AssetCategoryApi.php @@ -10,7 +10,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -76,7 +76,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSET_CATEGORY_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_CATEGORY_URI, [$code], $data, $onSuccess, $onFail); } @@ -103,7 +103,7 @@ public function create(string $code, array $data = []): int return $this->resourceClient->createResource(static::ASSET_CATEGORIES_URI, [], $data); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ASSET_CATEGORIES_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/AssetManager/AssetApi.php b/src/Api/AssetManager/AssetApi.php index bb153320..deb569ef 100644 --- a/src/Api/AssetManager/AssetApi.php +++ b/src/Api/AssetManager/AssetApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; class AssetApi implements AssetApiInterface { @@ -75,7 +75,7 @@ public function delete(string $assetFamilyCode, string $assetCode): int /** * {@inheritdoc} */ - public function upsertAsync (string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_URI, [$assetFamilyCode, $assetCode], $data, $onSuccess, $onFail); } @@ -83,7 +83,7 @@ public function upsertAsync (string $assetFamilyCode, string $assetCode, array $ /** * {@inheritdoc} */ - public function upsertAsyncList (string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncJsonResourceList(static::ASSETS_URI, [$assetFamilyCode], $assets, $onSuccess, $onFail); } diff --git a/src/Api/AssetManager/AssetApiInterface.php b/src/Api/AssetManager/AssetApiInterface.php index 5108bb24..f11dafd7 100644 --- a/src/Api/AssetManager/AssetApiInterface.php +++ b/src/Api/AssetManager/AssetApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; interface AssetApiInterface { @@ -62,9 +62,9 @@ public function upsertList(string $assetFamilyCode, array $assets): array; * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; /** * Updates or creates several assets. @@ -74,9 +74,9 @@ public function upsertAsync(string $assetFamilyCode, string $assetCode, array $d * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsyncList(string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsyncList(string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): Promise; /** * Deletes an asset. diff --git a/src/Api/AssetManager/AssetAttributeApi.php b/src/Api/AssetManager/AssetAttributeApi.php index f329b638..615d15da 100644 --- a/src/Api/AssetManager/AssetAttributeApi.php +++ b/src/Api/AssetManager/AssetAttributeApi.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; class AssetAttributeApi implements AssetAttributeApiInterface { @@ -44,7 +44,7 @@ public function upsert(string $assetFamilyCode, string $attributeCode, array $da /** * {@inheritdoc} */ - public function upsertAsync (string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_ATTRIBUTE_URI, [$assetFamilyCode, $attributeCode], $data, $onSuccess, $onFail); } diff --git a/src/Api/AssetManager/AssetAttributeApiInterface.php b/src/Api/AssetManager/AssetAttributeApiInterface.php index 547efaff..75060df8 100644 --- a/src/Api/AssetManager/AssetAttributeApiInterface.php +++ b/src/Api/AssetManager/AssetAttributeApiInterface.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Exception\HttpException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; interface AssetAttributeApiInterface { @@ -38,7 +38,7 @@ public function upsert(string $assetFamilyCode, string $attributeCode, array $da * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/AssetManager/AssetAttributeOptionApi.php b/src/Api/AssetManager/AssetAttributeOptionApi.php index c915e6f1..fcb2db5a 100644 --- a/src/Api/AssetManager/AssetAttributeOptionApi.php +++ b/src/Api/AssetManager/AssetAttributeOptionApi.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; class AssetAttributeOptionApi implements AssetAttributeOptionApiInterface { @@ -51,7 +51,7 @@ public function upsert(string $assetFamilyCode, string $attributeCode, string $a ); } - public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface + public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource( static::ASSET_ATTRIBUTE_OPTION_URI, diff --git a/src/Api/AssetManager/AssetAttributeOptionApiInterface.php b/src/Api/AssetManager/AssetAttributeOptionApiInterface.php index 04caf4b9..c328b161 100644 --- a/src/Api/AssetManager/AssetAttributeOptionApiInterface.php +++ b/src/Api/AssetManager/AssetAttributeOptionApiInterface.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Exception\HttpException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; interface AssetAttributeOptionApiInterface { @@ -38,7 +38,7 @@ public function upsert(string $assetFamilyCode, string $attributeCode, string $a * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/AssetManager/AssetFamilyApi.php b/src/Api/AssetManager/AssetFamilyApi.php index 2712ef82..f87be7b8 100644 --- a/src/Api/AssetManager/AssetFamilyApi.php +++ b/src/Api/AssetManager/AssetFamilyApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; class AssetFamilyApi implements AssetFamilyApiInterface { @@ -59,7 +59,7 @@ public function upsert(string $code, array $data = []): int /** * {@inheritdoc} */ - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_FAMILY_URI, [$code], $data, $onSuccess, $onFail); } diff --git a/src/Api/AssetManager/AssetFamilyApiInterface.php b/src/Api/AssetManager/AssetFamilyApiInterface.php index c5ffa482..cc4a03c3 100644 --- a/src/Api/AssetManager/AssetFamilyApiInterface.php +++ b/src/Api/AssetManager/AssetFamilyApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; interface AssetFamilyApiInterface { @@ -39,7 +39,7 @@ public function upsert(string $assetFamilyCode, array $data = []): int; * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $assetFamilyCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/AssetTagApi.php b/src/Api/AssetTagApi.php index e9068b41..61f19313 100644 --- a/src/Api/AssetTagApi.php +++ b/src/Api/AssetTagApi.php @@ -9,7 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * API implementation to manage asset tags. @@ -73,7 +73,7 @@ public function listPerPage(int $limit = 100, bool $withCount = false, array $qu return $this->pageFactory->createPage($data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_TAG_URI, [$code], $data, $onSuccess, $onFail); } diff --git a/src/Api/AssociationTypeApi.php b/src/Api/AssociationTypeApi.php index e889fee9..3e6fe10c 100644 --- a/src/Api/AssociationTypeApi.php +++ b/src/Api/AssociationTypeApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -77,7 +77,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSOCIATION_TYPE_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ASSOCIATION_TYPE_URI, [$code], $data, $onSuccess, $onFail); } @@ -90,7 +90,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ASSOCIATION_TYPES_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ASSOCIATION_TYPES_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/AttributeApi.php b/src/Api/AttributeApi.php index a6934f82..46451d64 100644 --- a/src/Api/AttributeApi.php +++ b/src/Api/AttributeApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +80,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ATTRIBUTE_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_URI, [$code], $data, $onSuccess, $onFail); } @@ -93,7 +93,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTES_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTES_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/AttributeGroupApi.php b/src/Api/AttributeGroupApi.php index f7b76243..7144961f 100644 --- a/src/Api/AttributeGroupApi.php +++ b/src/Api/AttributeGroupApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +80,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ATTRIBUTE_GROUP_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_GROUP_URI, [$code], $data, $onSuccess, $onFail); } @@ -93,7 +93,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTE_GROUPS_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTE_GROUPS_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/AttributeOptionApi.php b/src/Api/AttributeOptionApi.php index 152a2cfc..a049984f 100644 --- a/src/Api/AttributeOptionApi.php +++ b/src/Api/AttributeOptionApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * API implementation to manage the attribute options. @@ -93,12 +93,12 @@ public function upsertList($attributeCode, $attributeOptions): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions); } - public function upsertAsyncList ($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions, $onSuccess, $onFail); } - public function upsertAsync ($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_OPTION_URI, [$attributeCode, $attributeOptionCode], $data, $onSuccess, $onFail); } diff --git a/src/Api/AttributeOptionApiInterface.php b/src/Api/AttributeOptionApiInterface.php index 9121fdb2..e8e95bd9 100644 --- a/src/Api/AttributeOptionApiInterface.php +++ b/src/Api/AttributeOptionApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException; use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -97,9 +97,9 @@ public function upsert($attributeCode, $attributeOptionCode, array $data = []): * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; /** * Updates or creates several attribute options at once. @@ -121,7 +121,7 @@ public function upsertList($attributeCode, $attributeOptions): \Traversable; * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsyncList($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsyncList($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/CategoryApi.php b/src/Api/CategoryApi.php index 45a4dd04..9d6b124e 100644 --- a/src/Api/CategoryApi.php +++ b/src/Api/CategoryApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +80,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::CATEGORY_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::CATEGORY_URI, [$code], $data, $onSuccess, $onFail); } @@ -93,7 +93,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::CATEGORIES_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::CATEGORIES_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/ChannelApi.php b/src/Api/ChannelApi.php index 0afc12d8..8bd53a54 100644 --- a/src/Api/ChannelApi.php +++ b/src/Api/ChannelApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +80,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::CHANNEL_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::CHANNEL_URI, [$code], $data, $onSuccess, $onFail); } @@ -93,7 +93,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::CHANNELS_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::CHANNELS_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/FamilyApi.php b/src/Api/FamilyApi.php index de2cacd5..43fba8d2 100644 --- a/src/Api/FamilyApi.php +++ b/src/Api/FamilyApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +80,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::FAMILY_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::FAMILY_URI, [$code], $data, $onSuccess, $onFail); } @@ -93,7 +93,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::FAMILIES_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::FAMILIES_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/FamilyVariantApi.php b/src/Api/FamilyVariantApi.php index e94755be..24d08ac8 100644 --- a/src/Api/FamilyVariantApi.php +++ b/src/Api/FamilyVariantApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * Api implementation to manages Family Variants @@ -103,7 +103,10 @@ public function upsertList($familyCode, $familyVariants): \Traversable return $this->resourceClient->upsertStreamResourceList(static::FAMILY_VARIANTS_URI, [$familyCode], $familyVariants); } - public function upsertAsync($familyCode, $familyVariantCode, array $data = []): PromiseInterface + /** + * {@inheritdoc} + */ + public function upsertAsync($familyCode, $familyVariantCode, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): Promise { if (array_key_exists('family', $data)) { throw new InvalidArgumentException('The parameter "family" must not be defined in the data parameter'); @@ -116,7 +119,10 @@ public function upsertAsync($familyCode, $familyVariantCode, array $data = []): return $this->resourceClient->upsertAsyncResource(static::FAMILY_VARIANT_URI, [$familyCode, $familyVariantCode], $data); } - public function upsertAsyncList ($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): PromiseInterface + /** + * {@inheritdoc} + */ + public function upsertAsyncList($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::FAMILY_VARIANTS_URI, [$familyCode], $familyVariants, $onSuccess, $onFail); } diff --git a/src/Api/FamilyVariantApiInterface.php b/src/Api/FamilyVariantApiInterface.php index e7daf9e6..e71336ab 100644 --- a/src/Api/FamilyVariantApiInterface.php +++ b/src/Api/FamilyVariantApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException; use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -73,9 +73,9 @@ public function upsert($familyCode, $familyVariantCode, array $data = []): int; * @throws HttpException If the request failed. * @throws InvalidArgumentException If the parameter "familyCode" is defined in the data parameter. * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync($familyCode, $familyVariantCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync($familyCode, $familyVariantCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; /** * Available since Akeneo PIM 2.0. @@ -132,7 +132,7 @@ public function upsertList($familyCode, $familyVariants): \Traversable; * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsyncList($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsyncList($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/Operation/UpsertableResourceInterface.php b/src/Api/Operation/UpsertableResourceInterface.php index d89e1fa3..a9afe222 100644 --- a/src/Api/Operation/UpsertableResourceInterface.php +++ b/src/Api/Operation/UpsertableResourceInterface.php @@ -3,7 +3,7 @@ namespace Akeneo\Pim\ApiClient\Api\Operation; use Akeneo\Pim\ApiClient\Exception\HttpException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * API that can "upsert" a resource. @@ -35,7 +35,7 @@ public function upsert(string $code, array $data = []): int; * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/Operation/UpsertableResourceListInterface.php b/src/Api/Operation/UpsertableResourceListInterface.php index 3bdb9199..53c43b06 100644 --- a/src/Api/Operation/UpsertableResourceListInterface.php +++ b/src/Api/Operation/UpsertableResourceListInterface.php @@ -3,7 +3,7 @@ namespace Akeneo\Pim\ApiClient\Api\Operation; use Akeneo\Pim\ApiClient\Exception\HttpException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -33,7 +33,7 @@ public function upsertList(array|StreamInterface $resources): \Traversable; * * @throws HttpException * - * @return PromiseInterface returns a Promise + * @return Promise returns a Promise */ - public function upsertAsync(array|StreamInterface $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsyncList(array|StreamInterface $resources, callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/ProductApi.php b/src/Api/ProductApi.php index ddaa06ee..f22bad86 100644 --- a/src/Api/ProductApi.php +++ b/src/Api/ProductApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -82,7 +82,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::PRODUCT_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::PRODUCT_URI, [$code], $data, $onSuccess, $onFail); } @@ -103,7 +103,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::PRODUCTS_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCTS_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/ProductModelApi.php b/src/Api/ProductModelApi.php index e837d339..292663d9 100644 --- a/src/Api/ProductModelApi.php +++ b/src/Api/ProductModelApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -116,7 +116,7 @@ public function delete(string $code): int return $this->resourceClient->deleteResource(static::PRODUCT_MODEL_URI, [$code]); } - public function upsertAsync(string $code, array $data = []): PromiseInterface + public function upsertAsync(string $code, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): Promise { if (array_key_exists('code', $data)) { throw new InvalidArgumentException('The parameter "code" must not be defined in the data parameter'); @@ -127,7 +127,7 @@ public function upsertAsync(string $code, array $data = []): PromiseInterface return $this->resourceClient->upsertAsyncResource(static::PRODUCT_MODEL_URI, [$code], $data); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCT_MODELS_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/ProductUuidApi.php b/src/Api/ProductUuidApi.php index 65b333bb..b669079b 100644 --- a/src/Api/ProductUuidApi.php +++ b/src/Api/ProductUuidApi.php @@ -10,7 +10,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -65,7 +65,7 @@ public function upsert(string $uuid, array $data = []): int return $this->resourceClient->upsertResource(static::PRODUCT_UUID_URI, [$uuid], $data); } - public function upsertAsync (string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::PRODUCT_UUID_URI, [$uuid], $data, $onSuccess, $onFail); } @@ -80,7 +80,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::PRODUCTS_UUID_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCTS_UUID_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/ProductUuidApiInterface.php b/src/Api/ProductUuidApiInterface.php index f69d8f1d..5052febe 100644 --- a/src/Api/ProductUuidApiInterface.php +++ b/src/Api/ProductUuidApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Api\Operation\ListableResourceInterface; use Akeneo\Pim\ApiClient\Api\Operation\UpsertableResourceListInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -20,7 +20,7 @@ public function create(string $uuid, array $data = []): int; public function upsert(string $uuid, array $data = []): int; - public function upsertAsync(string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; public function delete(string $uuid): int; } diff --git a/src/Api/ReferenceEntityApi.php b/src/Api/ReferenceEntityApi.php index b7c92b1c..f67e7026 100644 --- a/src/Api/ReferenceEntityApi.php +++ b/src/Api/ReferenceEntityApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Tamara Robichet @@ -61,7 +61,7 @@ public function upsert(string $referenceEntityCode, array $data = []): int return $this->resourceClient->upsertResource(static::REFERENCE_ENTITY_URI, [$referenceEntityCode], $data); } - public function upsertAsync (string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_URI, [$referenceEntityCode], $data, $onSuccess, $onFail); } diff --git a/src/Api/ReferenceEntityApiInterface.php b/src/Api/ReferenceEntityApiInterface.php index 0615262f..b77bab16 100644 --- a/src/Api/ReferenceEntityApiInterface.php +++ b/src/Api/ReferenceEntityApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * API to manage the reference entities. @@ -60,7 +60,7 @@ public function upsert(string $referenceEntityCode, array $data = []): int; * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/ReferenceEntityAttributeApi.php b/src/Api/ReferenceEntityAttributeApi.php index 477eced6..cedcdc0f 100644 --- a/src/Api/ReferenceEntityAttributeApi.php +++ b/src/Api/ReferenceEntityAttributeApi.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Laurent Petard @@ -49,7 +49,7 @@ public function upsert(string $referenceEntityCode, string $attributeCode, array /** * {@inheritdoc} */ - public function upsertAsync (string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_ATTRIBUTE_URI, [$referenceEntityCode, $attributeCode], $data, $onSuccess, $onFail); } diff --git a/src/Api/ReferenceEntityAttributeApiInterface.php b/src/Api/ReferenceEntityAttributeApiInterface.php index dc5fa690..3250377d 100644 --- a/src/Api/ReferenceEntityAttributeApiInterface.php +++ b/src/Api/ReferenceEntityAttributeApiInterface.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Exception\HttpException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Laurent Petard @@ -61,7 +61,7 @@ public function upsert(string $referenceEntityCode, string $attributeCode, array * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/ReferenceEntityAttributeOptionApi.php b/src/Api/ReferenceEntityAttributeOptionApi.php index c36bc94b..fd628e9d 100644 --- a/src/Api/ReferenceEntityAttributeOptionApi.php +++ b/src/Api/ReferenceEntityAttributeOptionApi.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Laurent Petard @@ -59,7 +59,7 @@ public function upsert(string $referenceEntityCode, string $attributeCode, strin /** * {@inheritdoc} */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface + public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource( static::REFERENCE_ENTITY_ATTRIBUTE_OPTION_URI, diff --git a/src/Api/ReferenceEntityAttributeOptionApiInterface.php b/src/Api/ReferenceEntityAttributeOptionApiInterface.php index 2eed7f18..9358f943 100644 --- a/src/Api/ReferenceEntityAttributeOptionApiInterface.php +++ b/src/Api/ReferenceEntityAttributeOptionApiInterface.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Exception\HttpException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Laurent Petard @@ -64,7 +64,7 @@ public function upsert(string $referenceEntityCode, string $attributeCode, strin * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/ReferenceEntityRecordApi.php b/src/Api/ReferenceEntityRecordApi.php index bb6f80e5..cd0a7d3e 100644 --- a/src/Api/ReferenceEntityRecordApi.php +++ b/src/Api/ReferenceEntityRecordApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Laurent Petard @@ -69,12 +69,12 @@ public function upsertList(string $referenceEntityCode, array $records): array return $this->resourceClient->upsertJsonResourceList(static::REFERENCE_ENTITY_RECORDS_URI, [$referenceEntityCode], $records); } - public function upsertAsync (string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_RECORD_URI, [$referenceEntityCode, $recordCode], $data, $onSuccess, $onFail); } - public function upsertAsyncList (string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncJsonResourceList(static::REFERENCE_ENTITY_RECORDS_URI, [$referenceEntityCode], $records, $onSuccess, $onFail); } diff --git a/src/Api/ReferenceEntityRecordApiInterface.php b/src/Api/ReferenceEntityRecordApiInterface.php index cb95eb90..54dbf32d 100644 --- a/src/Api/ReferenceEntityRecordApiInterface.php +++ b/src/Api/ReferenceEntityRecordApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * API to mange the reference entity records. @@ -64,9 +64,9 @@ public function upsert(string $referenceEntityCode, string $recordCode, array $d * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; /** * Updates or creates several reference entity records. @@ -88,7 +88,7 @@ public function upsertList(string $referenceEntityCode, array $records): array; * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsyncList(string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsyncList(string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Client/AuthenticatedHttpClient.php b/src/Client/AuthenticatedHttpClient.php index 139d3d08..e007b448 100644 --- a/src/Client/AuthenticatedHttpClient.php +++ b/src/Client/AuthenticatedHttpClient.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\UnauthorizedHttpException; use Akeneo\Pim\ApiClient\Exception\UnprocessableEntityHttpException; use Akeneo\Pim\ApiClient\Security\Authentication; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\ResponseInterface; /** @@ -84,7 +84,7 @@ public function sendAsync( array $headers = [], $body = null, callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { if (null === $this->authentication->getAccessToken()) { $tokens = $this->authenticationApi->authenticateByPassword( diff --git a/src/Client/CachedResourceClient.php b/src/Client/CachedResourceClient.php index 366a409b..b9efe716 100644 --- a/src/Client/CachedResourceClient.php +++ b/src/Client/CachedResourceClient.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Client; use Akeneo\Pim\ApiClient\Cache\CacheInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\ResponseInterface; /** @@ -79,7 +79,7 @@ public function upsertAsyncResource( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource($uri, $uriParameters, $body, $onSuccess, $onFail); } @@ -97,7 +97,7 @@ public function upsertAsyncStreamResourceList( array $uriParameters = [], $resources = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList($uri, $uriParameters, $resources, $onSuccess, $onFail); } @@ -115,7 +115,7 @@ public function upsertAsyncJsonResourceList( array $uriParameters = [], array $resources = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncJsonResourceList($uri, $uriParameters, $resources, $onSuccess, $onFail); } @@ -157,7 +157,7 @@ public function upsertAsyncAndReturnPromise( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncAndReturnPromise($uri, $uriParameters, $body, $onSuccess, $onFail); } diff --git a/src/Client/ClientInterface.php b/src/Client/ClientInterface.php index 32e8c8aa..eae91f47 100644 --- a/src/Client/ClientInterface.php +++ b/src/Client/ClientInterface.php @@ -4,11 +4,11 @@ namespace Akeneo\Pim\ApiClient\Client; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Client\ClientInterface as BaseClientInterface; use Psr\Http\Message\RequestInterface; interface ClientInterface extends BaseClientInterface { - public function sendAsync(RequestInterface $request): PromiseInterface; + public function sendAsyncRequest(RequestInterface $request): Promise; } diff --git a/src/Client/HttpClient.php b/src/Client/HttpClient.php index 3e3feeef..76e587d1 100644 --- a/src/Client/HttpClient.php +++ b/src/Client/HttpClient.php @@ -2,7 +2,7 @@ namespace Akeneo\Pim\ApiClient\Client; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\RequestFactoryInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -33,7 +33,7 @@ class HttpClient implements HttpClientInterface protected HttpExceptionHandler $httpExceptionHandler; public function __construct( - protected ClientInterface $httpClient, + protected ClientInterface|\Psr\Http\Client\ClientInterface $httpClient, protected RequestFactoryInterface $requestFactory, private StreamFactoryInterface $streamFactory, private Options $options @@ -83,10 +83,10 @@ public function sendAsync( array $headers = [], $body = null, callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { $request = $this->prepareRequest($httpMethod, $uri, $headers, $body); - return $this->httpClient->sendAsync($request)->then($onSuccess, $onFail); + return $this->httpClient->sendAsyncRequest($request)->then($onSuccess, $onFail); } } diff --git a/src/Client/HttpClientInterface.php b/src/Client/HttpClientInterface.php index c103c218..e74d9fbe 100644 --- a/src/Client/HttpClientInterface.php +++ b/src/Client/HttpClientInterface.php @@ -3,7 +3,7 @@ namespace Akeneo\Pim\ApiClient\Client; use Akeneo\Pim\ApiClient\Exception\HttpException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; use Psr\Http\Message\UriInterface; @@ -43,7 +43,7 @@ public function sendRequest(string $httpMethod, $uri, array $headers = [], $body * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return Promise */ public function sendAsync( string $httpMethod, @@ -51,5 +51,5 @@ public function sendAsync( array $headers = [], $body = null, callable $onSuccess = null, - callable $onFail = null): PromiseInterface; + callable $onFail = null): Promise; } diff --git a/src/Client/ResourceClient.php b/src/Client/ResourceClient.php index f4b94c5f..6bc7141c 100644 --- a/src/Client/ResourceClient.php +++ b/src/Client/ResourceClient.php @@ -9,7 +9,7 @@ use Akeneo\Pim\ApiClient\Routing\UriGeneratorInterface; use Akeneo\Pim\ApiClient\Stream\MultipartStreamBuilderFactory; use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponseFactory; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; @@ -130,7 +130,7 @@ public function upsertAsyncResource( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { return $this->sendAsyncUpsertRequest($uri, $uriParameters, $body, $onSuccess, $onFail); } @@ -150,12 +150,12 @@ public function upsertAsyncAndReturnPromise( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { return $this->sendAsyncUpsertRequest($uri, $uriParameters, $body, $onSuccess, $onFail); } - public function prepareResourceListRequest(array $resources): string + public function prepareResourceListRequest(array|StreamInterface $resources): StreamInterface|string { if (!is_array($resources) && !$resources instanceof StreamInterface) { throw new InvalidArgumentException('The parameter "resources" must be an array or an instance of StreamInterface.'); @@ -201,7 +201,7 @@ public function upsertAsyncStreamResourceList( array $uriParameters = [], $resources = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { $body = $this->prepareResourceListRequest($resources); $uri = $this->uriGenerator->generate($uri, $uriParameters); @@ -241,7 +241,7 @@ public function upsertAsyncJsonResourceList( array $uriParameters = [], array $resources = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { $uri = $this->uriGenerator->generate($uri, $uriParameters); return $this->httpClient->sendAsync( @@ -309,7 +309,7 @@ private function sendAsyncUpsertRequest( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { unset($body['_links']); diff --git a/src/Client/ResourceClientInterface.php b/src/Client/ResourceClientInterface.php index e4c472ef..d4698594 100644 --- a/src/Client/ResourceClientInterface.php +++ b/src/Client/ResourceClientInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; @@ -121,14 +121,14 @@ public function upsertResource(string $uri, array $uriParameters = [], array $bo * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return Promise */ public function upsertAsyncResource( string $uri, array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface; + callable $onFail = null): Promise; /** * Creates and returns a resource if it does not exist yet, otherwise updates partially and returns the resource. @@ -159,7 +159,7 @@ public function upsertAsyncAndReturnPromise( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface; + callable $onFail = null): Promise; /** * Updates or creates several resources using a stream for the request and the response. @@ -189,14 +189,14 @@ public function upsertStreamResourceList(string $uri, array $uriParameters = [], * @throws HttpException If the request failed. * @throws InvalidArgumentException If the resources or any part thereof are invalid. * - * @return PromiseInterface returns a Promise + * @return Promise returns a Promise */ public function upsertAsyncStreamResourceList( string $uri, array $uriParameters = [], $resources = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface; + callable $onFail = null): Promise; /** * Updates or creates several resources using a single JSON string for the request and the response. @@ -224,14 +224,14 @@ public function upsertJsonResourceList(string $uri, array $uriParameters = [], a * @throws HttpException If the request failed. * @throws InvalidArgumentException If the resources or any part thereof are invalid. * - * @return PromiseInterface + * @return Promise */ public function upsertAsyncJsonResourceList( string $uri, array $uriParameters = [], array $resources = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface; + callable $onFail = null): Promise; /** * Deletes a resource. diff --git a/tests/Api/UpsertListProductTest.php b/tests/Api/UpsertListProductTest.php index ecad688b..79a40c9e 100644 --- a/tests/Api/UpsertListProductTest.php +++ b/tests/Api/UpsertListProductTest.php @@ -6,6 +6,7 @@ use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; use donatj\MockWebServer\ResponseStack; +use GuzzleHttp\Promise\Utils; use Http\Discovery\Psr17FactoryDiscovery; use PHPUnit\Framework\Assert; From e41246a0ed8f7a6f5f9b0d1acf38a664d740f639 Mon Sep 17 00:00:00 2001 From: gwendalaubert Date: Mon, 26 Jun 2023 11:20:56 +0200 Subject: [PATCH 04/10] DX-104 : Deleting tests --- src/AkeneoPimClientBuilder.php | 4 ++-- src/Api/AppCatalog/AppCatalogApi.php | 4 ++-- src/Api/AppCatalog/AppCatalogApiInterface.php | 4 ++-- src/Api/AssetApi.php | 6 +++--- src/Api/AssetCategoryApi.php | 6 +++--- src/Api/AssetManager/AssetApi.php | 6 +++--- src/Api/AssetManager/AssetApiInterface.php | 10 +++++----- src/Api/AssetManager/AssetAttributeApi.php | 4 ++-- .../AssetManager/AssetAttributeApiInterface.php | 6 +++--- src/Api/AssetManager/AssetAttributeOptionApi.php | 4 ++-- .../AssetAttributeOptionApiInterface.php | 6 +++--- src/Api/AssetManager/AssetFamilyApi.php | 4 ++-- src/Api/AssetManager/AssetFamilyApiInterface.php | 6 +++--- src/Api/AssetTagApi.php | 4 ++-- src/Api/AssociationTypeApi.php | 6 +++--- src/Api/AttributeApi.php | 6 +++--- src/Api/AttributeGroupApi.php | 6 +++--- src/Api/AttributeOptionApi.php | 6 +++--- src/Api/AttributeOptionApiInterface.php | 10 +++++----- src/Api/CategoryApi.php | 6 +++--- src/Api/ChannelApi.php | 6 +++--- src/Api/FamilyApi.php | 6 +++--- src/Api/FamilyVariantApi.php | 12 +++++++++--- src/Api/FamilyVariantApiInterface.php | 10 +++++----- .../Operation/UpsertableResourceInterface.php | 6 +++--- .../UpsertableResourceListInterface.php | 6 +++--- src/Api/ProductApi.php | 6 +++--- src/Api/ProductModelApi.php | 6 +++--- src/Api/ProductUuidApi.php | 6 +++--- src/Api/ProductUuidApiInterface.php | 4 ++-- src/Api/ReferenceEntityApi.php | 4 ++-- src/Api/ReferenceEntityApiInterface.php | 6 +++--- src/Api/ReferenceEntityAttributeApi.php | 4 ++-- src/Api/ReferenceEntityAttributeApiInterface.php | 6 +++--- src/Api/ReferenceEntityAttributeOptionApi.php | 4 ++-- ...eferenceEntityAttributeOptionApiInterface.php | 6 +++--- src/Api/ReferenceEntityRecordApi.php | 6 +++--- src/Api/ReferenceEntityRecordApiInterface.php | 10 +++++----- src/Client/AuthenticatedHttpClient.php | 4 ++-- src/Client/CachedResourceClient.php | 10 +++++----- src/Client/ClientInterface.php | 4 ++-- src/Client/HttpClient.php | 8 ++++---- src/Client/HttpClientInterface.php | 6 +++--- src/Client/ResourceClient.php | 14 +++++++------- src/Client/ResourceClientInterface.php | 16 ++++++++-------- tests/Api/UpsertListProductTest.php | 1 + 46 files changed, 149 insertions(+), 142 deletions(-) diff --git a/src/AkeneoPimClientBuilder.php b/src/AkeneoPimClientBuilder.php index febc4d68..b302a919 100644 --- a/src/AkeneoPimClientBuilder.php +++ b/src/AkeneoPimClientBuilder.php @@ -46,6 +46,7 @@ use Akeneo\Pim\ApiClient\Client\CachedResourceClient; use Akeneo\Pim\ApiClient\Client\HttpClient; use Akeneo\Pim\ApiClient\Client\Options; +use Akeneo\Pim\ApiClient\Client\ClientInterface; use Akeneo\Pim\ApiClient\Client\ResourceClient; use Akeneo\Pim\ApiClient\FileSystem\FileSystemInterface; use Akeneo\Pim\ApiClient\FileSystem\LocalFileSystem; @@ -57,7 +58,6 @@ use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponseFactory; use Http\Discovery\Psr17FactoryDiscovery; use Http\Discovery\Psr18ClientDiscovery; -use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestFactoryInterface; use Psr\Http\Message\StreamFactoryInterface; @@ -295,7 +295,7 @@ protected function setUp(Authentication $authentication): array return [$resourceClient, $pageFactory, $cursorFactory, $fileSystem]; } - private function getHttpClient(): ClientInterface + private function getHttpClient(): ClientInterface|\Psr\Http\Client\ClientInterface { if (null === $this->httpClient) { $this->httpClient = Psr18ClientDiscovery::find(); diff --git a/src/Api/AppCatalog/AppCatalogApi.php b/src/Api/AppCatalog/AppCatalogApi.php index 93d9d188..07abfb9f 100644 --- a/src/Api/AppCatalog/AppCatalogApi.php +++ b/src/Api/AppCatalog/AppCatalogApi.php @@ -10,7 +10,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -62,7 +62,7 @@ public function delete(string $code): int return $this->resourceClient->deleteResource(static::APP_CATALOG_URI, [$code]); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncAndReturnPromise(static::APP_CATALOG_URI, [$code], $data, $onSuccess, $onFail); } diff --git a/src/Api/AppCatalog/AppCatalogApiInterface.php b/src/Api/AppCatalog/AppCatalogApiInterface.php index 756e064a..7204d3eb 100644 --- a/src/Api/AppCatalog/AppCatalogApiInterface.php +++ b/src/Api/AppCatalog/AppCatalogApiInterface.php @@ -7,7 +7,7 @@ use Akeneo\Pim\ApiClient\Api\Operation\DeletableResourceInterface; use Akeneo\Pim\ApiClient\Api\Operation\GettableResourceInterface; use Akeneo\Pim\ApiClient\Api\Operation\ListableResourceInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -21,5 +21,5 @@ interface AppCatalogApiInterface extends public function create(array $data): array; public function upsert(string $code, array $data = []): array; - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/AssetApi.php b/src/Api/AssetApi.php index dd2a42af..eb1a872f 100644 --- a/src/Api/AssetApi.php +++ b/src/Api/AssetApi.php @@ -10,7 +10,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -91,7 +91,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSET_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_URI, [$code], $data, $onSuccess, $onFail); } @@ -104,7 +104,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ASSETS_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(self::ASSETS_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/AssetCategoryApi.php b/src/Api/AssetCategoryApi.php index 23e2534f..03c4958d 100644 --- a/src/Api/AssetCategoryApi.php +++ b/src/Api/AssetCategoryApi.php @@ -10,7 +10,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -76,7 +76,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSET_CATEGORY_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_CATEGORY_URI, [$code], $data, $onSuccess, $onFail); } @@ -103,7 +103,7 @@ public function create(string $code, array $data = []): int return $this->resourceClient->createResource(static::ASSET_CATEGORIES_URI, [], $data); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ASSET_CATEGORIES_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/AssetManager/AssetApi.php b/src/Api/AssetManager/AssetApi.php index bb153320..deb569ef 100644 --- a/src/Api/AssetManager/AssetApi.php +++ b/src/Api/AssetManager/AssetApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; class AssetApi implements AssetApiInterface { @@ -75,7 +75,7 @@ public function delete(string $assetFamilyCode, string $assetCode): int /** * {@inheritdoc} */ - public function upsertAsync (string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_URI, [$assetFamilyCode, $assetCode], $data, $onSuccess, $onFail); } @@ -83,7 +83,7 @@ public function upsertAsync (string $assetFamilyCode, string $assetCode, array $ /** * {@inheritdoc} */ - public function upsertAsyncList (string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncJsonResourceList(static::ASSETS_URI, [$assetFamilyCode], $assets, $onSuccess, $onFail); } diff --git a/src/Api/AssetManager/AssetApiInterface.php b/src/Api/AssetManager/AssetApiInterface.php index 5108bb24..f11dafd7 100644 --- a/src/Api/AssetManager/AssetApiInterface.php +++ b/src/Api/AssetManager/AssetApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; interface AssetApiInterface { @@ -62,9 +62,9 @@ public function upsertList(string $assetFamilyCode, array $assets): array; * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; /** * Updates or creates several assets. @@ -74,9 +74,9 @@ public function upsertAsync(string $assetFamilyCode, string $assetCode, array $d * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsyncList(string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsyncList(string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): Promise; /** * Deletes an asset. diff --git a/src/Api/AssetManager/AssetAttributeApi.php b/src/Api/AssetManager/AssetAttributeApi.php index f329b638..615d15da 100644 --- a/src/Api/AssetManager/AssetAttributeApi.php +++ b/src/Api/AssetManager/AssetAttributeApi.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; class AssetAttributeApi implements AssetAttributeApiInterface { @@ -44,7 +44,7 @@ public function upsert(string $assetFamilyCode, string $attributeCode, array $da /** * {@inheritdoc} */ - public function upsertAsync (string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_ATTRIBUTE_URI, [$assetFamilyCode, $attributeCode], $data, $onSuccess, $onFail); } diff --git a/src/Api/AssetManager/AssetAttributeApiInterface.php b/src/Api/AssetManager/AssetAttributeApiInterface.php index 547efaff..75060df8 100644 --- a/src/Api/AssetManager/AssetAttributeApiInterface.php +++ b/src/Api/AssetManager/AssetAttributeApiInterface.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Exception\HttpException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; interface AssetAttributeApiInterface { @@ -38,7 +38,7 @@ public function upsert(string $assetFamilyCode, string $attributeCode, array $da * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/AssetManager/AssetAttributeOptionApi.php b/src/Api/AssetManager/AssetAttributeOptionApi.php index c915e6f1..fcb2db5a 100644 --- a/src/Api/AssetManager/AssetAttributeOptionApi.php +++ b/src/Api/AssetManager/AssetAttributeOptionApi.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; class AssetAttributeOptionApi implements AssetAttributeOptionApiInterface { @@ -51,7 +51,7 @@ public function upsert(string $assetFamilyCode, string $attributeCode, string $a ); } - public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface + public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource( static::ASSET_ATTRIBUTE_OPTION_URI, diff --git a/src/Api/AssetManager/AssetAttributeOptionApiInterface.php b/src/Api/AssetManager/AssetAttributeOptionApiInterface.php index 04caf4b9..c328b161 100644 --- a/src/Api/AssetManager/AssetAttributeOptionApiInterface.php +++ b/src/Api/AssetManager/AssetAttributeOptionApiInterface.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Exception\HttpException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; interface AssetAttributeOptionApiInterface { @@ -38,7 +38,7 @@ public function upsert(string $assetFamilyCode, string $attributeCode, string $a * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/AssetManager/AssetFamilyApi.php b/src/Api/AssetManager/AssetFamilyApi.php index 2712ef82..f87be7b8 100644 --- a/src/Api/AssetManager/AssetFamilyApi.php +++ b/src/Api/AssetManager/AssetFamilyApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; class AssetFamilyApi implements AssetFamilyApiInterface { @@ -59,7 +59,7 @@ public function upsert(string $code, array $data = []): int /** * {@inheritdoc} */ - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_FAMILY_URI, [$code], $data, $onSuccess, $onFail); } diff --git a/src/Api/AssetManager/AssetFamilyApiInterface.php b/src/Api/AssetManager/AssetFamilyApiInterface.php index c5ffa482..cc4a03c3 100644 --- a/src/Api/AssetManager/AssetFamilyApiInterface.php +++ b/src/Api/AssetManager/AssetFamilyApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; interface AssetFamilyApiInterface { @@ -39,7 +39,7 @@ public function upsert(string $assetFamilyCode, array $data = []): int; * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $assetFamilyCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/AssetTagApi.php b/src/Api/AssetTagApi.php index e9068b41..61f19313 100644 --- a/src/Api/AssetTagApi.php +++ b/src/Api/AssetTagApi.php @@ -9,7 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * API implementation to manage asset tags. @@ -73,7 +73,7 @@ public function listPerPage(int $limit = 100, bool $withCount = false, array $qu return $this->pageFactory->createPage($data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_TAG_URI, [$code], $data, $onSuccess, $onFail); } diff --git a/src/Api/AssociationTypeApi.php b/src/Api/AssociationTypeApi.php index e889fee9..3e6fe10c 100644 --- a/src/Api/AssociationTypeApi.php +++ b/src/Api/AssociationTypeApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -77,7 +77,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSOCIATION_TYPE_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ASSOCIATION_TYPE_URI, [$code], $data, $onSuccess, $onFail); } @@ -90,7 +90,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ASSOCIATION_TYPES_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ASSOCIATION_TYPES_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/AttributeApi.php b/src/Api/AttributeApi.php index a6934f82..46451d64 100644 --- a/src/Api/AttributeApi.php +++ b/src/Api/AttributeApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +80,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ATTRIBUTE_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_URI, [$code], $data, $onSuccess, $onFail); } @@ -93,7 +93,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTES_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTES_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/AttributeGroupApi.php b/src/Api/AttributeGroupApi.php index f7b76243..7144961f 100644 --- a/src/Api/AttributeGroupApi.php +++ b/src/Api/AttributeGroupApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +80,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ATTRIBUTE_GROUP_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_GROUP_URI, [$code], $data, $onSuccess, $onFail); } @@ -93,7 +93,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTE_GROUPS_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTE_GROUPS_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/AttributeOptionApi.php b/src/Api/AttributeOptionApi.php index 152a2cfc..a049984f 100644 --- a/src/Api/AttributeOptionApi.php +++ b/src/Api/AttributeOptionApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * API implementation to manage the attribute options. @@ -93,12 +93,12 @@ public function upsertList($attributeCode, $attributeOptions): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions); } - public function upsertAsyncList ($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions, $onSuccess, $onFail); } - public function upsertAsync ($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_OPTION_URI, [$attributeCode, $attributeOptionCode], $data, $onSuccess, $onFail); } diff --git a/src/Api/AttributeOptionApiInterface.php b/src/Api/AttributeOptionApiInterface.php index 9121fdb2..e8e95bd9 100644 --- a/src/Api/AttributeOptionApiInterface.php +++ b/src/Api/AttributeOptionApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException; use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -97,9 +97,9 @@ public function upsert($attributeCode, $attributeOptionCode, array $data = []): * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; /** * Updates or creates several attribute options at once. @@ -121,7 +121,7 @@ public function upsertList($attributeCode, $attributeOptions): \Traversable; * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsyncList($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsyncList($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/CategoryApi.php b/src/Api/CategoryApi.php index 45a4dd04..9d6b124e 100644 --- a/src/Api/CategoryApi.php +++ b/src/Api/CategoryApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +80,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::CATEGORY_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::CATEGORY_URI, [$code], $data, $onSuccess, $onFail); } @@ -93,7 +93,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::CATEGORIES_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::CATEGORIES_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/ChannelApi.php b/src/Api/ChannelApi.php index 0afc12d8..8bd53a54 100644 --- a/src/Api/ChannelApi.php +++ b/src/Api/ChannelApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +80,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::CHANNEL_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::CHANNEL_URI, [$code], $data, $onSuccess, $onFail); } @@ -93,7 +93,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::CHANNELS_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::CHANNELS_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/FamilyApi.php b/src/Api/FamilyApi.php index de2cacd5..43fba8d2 100644 --- a/src/Api/FamilyApi.php +++ b/src/Api/FamilyApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +80,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::FAMILY_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::FAMILY_URI, [$code], $data, $onSuccess, $onFail); } @@ -93,7 +93,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::FAMILIES_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::FAMILIES_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/FamilyVariantApi.php b/src/Api/FamilyVariantApi.php index e94755be..24d08ac8 100644 --- a/src/Api/FamilyVariantApi.php +++ b/src/Api/FamilyVariantApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * Api implementation to manages Family Variants @@ -103,7 +103,10 @@ public function upsertList($familyCode, $familyVariants): \Traversable return $this->resourceClient->upsertStreamResourceList(static::FAMILY_VARIANTS_URI, [$familyCode], $familyVariants); } - public function upsertAsync($familyCode, $familyVariantCode, array $data = []): PromiseInterface + /** + * {@inheritdoc} + */ + public function upsertAsync($familyCode, $familyVariantCode, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): Promise { if (array_key_exists('family', $data)) { throw new InvalidArgumentException('The parameter "family" must not be defined in the data parameter'); @@ -116,7 +119,10 @@ public function upsertAsync($familyCode, $familyVariantCode, array $data = []): return $this->resourceClient->upsertAsyncResource(static::FAMILY_VARIANT_URI, [$familyCode, $familyVariantCode], $data); } - public function upsertAsyncList ($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): PromiseInterface + /** + * {@inheritdoc} + */ + public function upsertAsyncList($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::FAMILY_VARIANTS_URI, [$familyCode], $familyVariants, $onSuccess, $onFail); } diff --git a/src/Api/FamilyVariantApiInterface.php b/src/Api/FamilyVariantApiInterface.php index e7daf9e6..e71336ab 100644 --- a/src/Api/FamilyVariantApiInterface.php +++ b/src/Api/FamilyVariantApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException; use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -73,9 +73,9 @@ public function upsert($familyCode, $familyVariantCode, array $data = []): int; * @throws HttpException If the request failed. * @throws InvalidArgumentException If the parameter "familyCode" is defined in the data parameter. * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync($familyCode, $familyVariantCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync($familyCode, $familyVariantCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; /** * Available since Akeneo PIM 2.0. @@ -132,7 +132,7 @@ public function upsertList($familyCode, $familyVariants): \Traversable; * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsyncList($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsyncList($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/Operation/UpsertableResourceInterface.php b/src/Api/Operation/UpsertableResourceInterface.php index d89e1fa3..a9afe222 100644 --- a/src/Api/Operation/UpsertableResourceInterface.php +++ b/src/Api/Operation/UpsertableResourceInterface.php @@ -3,7 +3,7 @@ namespace Akeneo\Pim\ApiClient\Api\Operation; use Akeneo\Pim\ApiClient\Exception\HttpException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * API that can "upsert" a resource. @@ -35,7 +35,7 @@ public function upsert(string $code, array $data = []): int; * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/Operation/UpsertableResourceListInterface.php b/src/Api/Operation/UpsertableResourceListInterface.php index 3bdb9199..53c43b06 100644 --- a/src/Api/Operation/UpsertableResourceListInterface.php +++ b/src/Api/Operation/UpsertableResourceListInterface.php @@ -3,7 +3,7 @@ namespace Akeneo\Pim\ApiClient\Api\Operation; use Akeneo\Pim\ApiClient\Exception\HttpException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -33,7 +33,7 @@ public function upsertList(array|StreamInterface $resources): \Traversable; * * @throws HttpException * - * @return PromiseInterface returns a Promise + * @return Promise returns a Promise */ - public function upsertAsync(array|StreamInterface $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsyncList(array|StreamInterface $resources, callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/ProductApi.php b/src/Api/ProductApi.php index ddaa06ee..f22bad86 100644 --- a/src/Api/ProductApi.php +++ b/src/Api/ProductApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -82,7 +82,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::PRODUCT_URI, [$code], $data); } - public function upsertAsync (string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::PRODUCT_URI, [$code], $data, $onSuccess, $onFail); } @@ -103,7 +103,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::PRODUCTS_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCTS_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/ProductModelApi.php b/src/Api/ProductModelApi.php index e837d339..292663d9 100644 --- a/src/Api/ProductModelApi.php +++ b/src/Api/ProductModelApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -116,7 +116,7 @@ public function delete(string $code): int return $this->resourceClient->deleteResource(static::PRODUCT_MODEL_URI, [$code]); } - public function upsertAsync(string $code, array $data = []): PromiseInterface + public function upsertAsync(string $code, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): Promise { if (array_key_exists('code', $data)) { throw new InvalidArgumentException('The parameter "code" must not be defined in the data parameter'); @@ -127,7 +127,7 @@ public function upsertAsync(string $code, array $data = []): PromiseInterface return $this->resourceClient->upsertAsyncResource(static::PRODUCT_MODEL_URI, [$code], $data); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCT_MODELS_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/ProductUuidApi.php b/src/Api/ProductUuidApi.php index 65b333bb..b669079b 100644 --- a/src/Api/ProductUuidApi.php +++ b/src/Api/ProductUuidApi.php @@ -10,7 +10,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -65,7 +65,7 @@ public function upsert(string $uuid, array $data = []): int return $this->resourceClient->upsertResource(static::PRODUCT_UUID_URI, [$uuid], $data); } - public function upsertAsync (string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::PRODUCT_UUID_URI, [$uuid], $data, $onSuccess, $onFail); } @@ -80,7 +80,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::PRODUCTS_UUID_URI, [], $resources); } - public function upsertAsyncList (StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCTS_UUID_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/ProductUuidApiInterface.php b/src/Api/ProductUuidApiInterface.php index f69d8f1d..5052febe 100644 --- a/src/Api/ProductUuidApiInterface.php +++ b/src/Api/ProductUuidApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Api\Operation\ListableResourceInterface; use Akeneo\Pim\ApiClient\Api\Operation\UpsertableResourceListInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -20,7 +20,7 @@ public function create(string $uuid, array $data = []): int; public function upsert(string $uuid, array $data = []): int; - public function upsertAsync(string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; public function delete(string $uuid): int; } diff --git a/src/Api/ReferenceEntityApi.php b/src/Api/ReferenceEntityApi.php index b7c92b1c..f67e7026 100644 --- a/src/Api/ReferenceEntityApi.php +++ b/src/Api/ReferenceEntityApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Tamara Robichet @@ -61,7 +61,7 @@ public function upsert(string $referenceEntityCode, array $data = []): int return $this->resourceClient->upsertResource(static::REFERENCE_ENTITY_URI, [$referenceEntityCode], $data); } - public function upsertAsync (string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_URI, [$referenceEntityCode], $data, $onSuccess, $onFail); } diff --git a/src/Api/ReferenceEntityApiInterface.php b/src/Api/ReferenceEntityApiInterface.php index 0615262f..b77bab16 100644 --- a/src/Api/ReferenceEntityApiInterface.php +++ b/src/Api/ReferenceEntityApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * API to manage the reference entities. @@ -60,7 +60,7 @@ public function upsert(string $referenceEntityCode, array $data = []): int; * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/ReferenceEntityAttributeApi.php b/src/Api/ReferenceEntityAttributeApi.php index 477eced6..cedcdc0f 100644 --- a/src/Api/ReferenceEntityAttributeApi.php +++ b/src/Api/ReferenceEntityAttributeApi.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Laurent Petard @@ -49,7 +49,7 @@ public function upsert(string $referenceEntityCode, string $attributeCode, array /** * {@inheritdoc} */ - public function upsertAsync (string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_ATTRIBUTE_URI, [$referenceEntityCode, $attributeCode], $data, $onSuccess, $onFail); } diff --git a/src/Api/ReferenceEntityAttributeApiInterface.php b/src/Api/ReferenceEntityAttributeApiInterface.php index dc5fa690..3250377d 100644 --- a/src/Api/ReferenceEntityAttributeApiInterface.php +++ b/src/Api/ReferenceEntityAttributeApiInterface.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Exception\HttpException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Laurent Petard @@ -61,7 +61,7 @@ public function upsert(string $referenceEntityCode, string $attributeCode, array * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/ReferenceEntityAttributeOptionApi.php b/src/Api/ReferenceEntityAttributeOptionApi.php index c36bc94b..fd628e9d 100644 --- a/src/Api/ReferenceEntityAttributeOptionApi.php +++ b/src/Api/ReferenceEntityAttributeOptionApi.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Laurent Petard @@ -59,7 +59,7 @@ public function upsert(string $referenceEntityCode, string $attributeCode, strin /** * {@inheritdoc} */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface + public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource( static::REFERENCE_ENTITY_ATTRIBUTE_OPTION_URI, diff --git a/src/Api/ReferenceEntityAttributeOptionApiInterface.php b/src/Api/ReferenceEntityAttributeOptionApiInterface.php index 2eed7f18..9358f943 100644 --- a/src/Api/ReferenceEntityAttributeOptionApiInterface.php +++ b/src/Api/ReferenceEntityAttributeOptionApiInterface.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Exception\HttpException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Laurent Petard @@ -64,7 +64,7 @@ public function upsert(string $referenceEntityCode, string $attributeCode, strin * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Api/ReferenceEntityRecordApi.php b/src/Api/ReferenceEntityRecordApi.php index bb6f80e5..cd0a7d3e 100644 --- a/src/Api/ReferenceEntityRecordApi.php +++ b/src/Api/ReferenceEntityRecordApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Laurent Petard @@ -69,12 +69,12 @@ public function upsertList(string $referenceEntityCode, array $records): array return $this->resourceClient->upsertJsonResourceList(static::REFERENCE_ENTITY_RECORDS_URI, [$referenceEntityCode], $records); } - public function upsertAsync (string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_RECORD_URI, [$referenceEntityCode, $recordCode], $data, $onSuccess, $onFail); } - public function upsertAsyncList (string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncJsonResourceList(static::REFERENCE_ENTITY_RECORDS_URI, [$referenceEntityCode], $records, $onSuccess, $onFail); } diff --git a/src/Api/ReferenceEntityRecordApiInterface.php b/src/Api/ReferenceEntityRecordApiInterface.php index cb95eb90..54dbf32d 100644 --- a/src/Api/ReferenceEntityRecordApiInterface.php +++ b/src/Api/ReferenceEntityRecordApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * API to mange the reference entity records. @@ -64,9 +64,9 @@ public function upsert(string $referenceEntityCode, string $recordCode, array $d * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return Promise */ - public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; /** * Updates or creates several reference entity records. @@ -88,7 +88,7 @@ public function upsertList(string $referenceEntityCode, array $records): array; * * @throws HttpException * - * @return PromiseInterface + * @return Promise */ - public function upsertAsyncList(string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsyncList(string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): Promise; } diff --git a/src/Client/AuthenticatedHttpClient.php b/src/Client/AuthenticatedHttpClient.php index 139d3d08..e007b448 100644 --- a/src/Client/AuthenticatedHttpClient.php +++ b/src/Client/AuthenticatedHttpClient.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\UnauthorizedHttpException; use Akeneo\Pim\ApiClient\Exception\UnprocessableEntityHttpException; use Akeneo\Pim\ApiClient\Security\Authentication; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\ResponseInterface; /** @@ -84,7 +84,7 @@ public function sendAsync( array $headers = [], $body = null, callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { if (null === $this->authentication->getAccessToken()) { $tokens = $this->authenticationApi->authenticateByPassword( diff --git a/src/Client/CachedResourceClient.php b/src/Client/CachedResourceClient.php index 366a409b..b9efe716 100644 --- a/src/Client/CachedResourceClient.php +++ b/src/Client/CachedResourceClient.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Client; use Akeneo\Pim\ApiClient\Cache\CacheInterface; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\ResponseInterface; /** @@ -79,7 +79,7 @@ public function upsertAsyncResource( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncResource($uri, $uriParameters, $body, $onSuccess, $onFail); } @@ -97,7 +97,7 @@ public function upsertAsyncStreamResourceList( array $uriParameters = [], $resources = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncStreamResourceList($uri, $uriParameters, $resources, $onSuccess, $onFail); } @@ -115,7 +115,7 @@ public function upsertAsyncJsonResourceList( array $uriParameters = [], array $resources = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncJsonResourceList($uri, $uriParameters, $resources, $onSuccess, $onFail); } @@ -157,7 +157,7 @@ public function upsertAsyncAndReturnPromise( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { return $this->resourceClient->upsertAsyncAndReturnPromise($uri, $uriParameters, $body, $onSuccess, $onFail); } diff --git a/src/Client/ClientInterface.php b/src/Client/ClientInterface.php index 32e8c8aa..eae91f47 100644 --- a/src/Client/ClientInterface.php +++ b/src/Client/ClientInterface.php @@ -4,11 +4,11 @@ namespace Akeneo\Pim\ApiClient\Client; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Client\ClientInterface as BaseClientInterface; use Psr\Http\Message\RequestInterface; interface ClientInterface extends BaseClientInterface { - public function sendAsync(RequestInterface $request): PromiseInterface; + public function sendAsyncRequest(RequestInterface $request): Promise; } diff --git a/src/Client/HttpClient.php b/src/Client/HttpClient.php index 3e3feeef..76e587d1 100644 --- a/src/Client/HttpClient.php +++ b/src/Client/HttpClient.php @@ -2,7 +2,7 @@ namespace Akeneo\Pim\ApiClient\Client; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\RequestFactoryInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -33,7 +33,7 @@ class HttpClient implements HttpClientInterface protected HttpExceptionHandler $httpExceptionHandler; public function __construct( - protected ClientInterface $httpClient, + protected ClientInterface|\Psr\Http\Client\ClientInterface $httpClient, protected RequestFactoryInterface $requestFactory, private StreamFactoryInterface $streamFactory, private Options $options @@ -83,10 +83,10 @@ public function sendAsync( array $headers = [], $body = null, callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { $request = $this->prepareRequest($httpMethod, $uri, $headers, $body); - return $this->httpClient->sendAsync($request)->then($onSuccess, $onFail); + return $this->httpClient->sendAsyncRequest($request)->then($onSuccess, $onFail); } } diff --git a/src/Client/HttpClientInterface.php b/src/Client/HttpClientInterface.php index c103c218..e74d9fbe 100644 --- a/src/Client/HttpClientInterface.php +++ b/src/Client/HttpClientInterface.php @@ -3,7 +3,7 @@ namespace Akeneo\Pim\ApiClient\Client; use Akeneo\Pim\ApiClient\Exception\HttpException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; use Psr\Http\Message\UriInterface; @@ -43,7 +43,7 @@ public function sendRequest(string $httpMethod, $uri, array $headers = [], $body * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return Promise */ public function sendAsync( string $httpMethod, @@ -51,5 +51,5 @@ public function sendAsync( array $headers = [], $body = null, callable $onSuccess = null, - callable $onFail = null): PromiseInterface; + callable $onFail = null): Promise; } diff --git a/src/Client/ResourceClient.php b/src/Client/ResourceClient.php index f4b94c5f..6bc7141c 100644 --- a/src/Client/ResourceClient.php +++ b/src/Client/ResourceClient.php @@ -9,7 +9,7 @@ use Akeneo\Pim\ApiClient\Routing\UriGeneratorInterface; use Akeneo\Pim\ApiClient\Stream\MultipartStreamBuilderFactory; use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponseFactory; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; @@ -130,7 +130,7 @@ public function upsertAsyncResource( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { return $this->sendAsyncUpsertRequest($uri, $uriParameters, $body, $onSuccess, $onFail); } @@ -150,12 +150,12 @@ public function upsertAsyncAndReturnPromise( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { return $this->sendAsyncUpsertRequest($uri, $uriParameters, $body, $onSuccess, $onFail); } - public function prepareResourceListRequest(array $resources): string + public function prepareResourceListRequest(array|StreamInterface $resources): StreamInterface|string { if (!is_array($resources) && !$resources instanceof StreamInterface) { throw new InvalidArgumentException('The parameter "resources" must be an array or an instance of StreamInterface.'); @@ -201,7 +201,7 @@ public function upsertAsyncStreamResourceList( array $uriParameters = [], $resources = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { $body = $this->prepareResourceListRequest($resources); $uri = $this->uriGenerator->generate($uri, $uriParameters); @@ -241,7 +241,7 @@ public function upsertAsyncJsonResourceList( array $uriParameters = [], array $resources = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { $uri = $this->uriGenerator->generate($uri, $uriParameters); return $this->httpClient->sendAsync( @@ -309,7 +309,7 @@ private function sendAsyncUpsertRequest( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface + callable $onFail = null): Promise { unset($body['_links']); diff --git a/src/Client/ResourceClientInterface.php b/src/Client/ResourceClientInterface.php index e4c472ef..d4698594 100644 --- a/src/Client/ResourceClientInterface.php +++ b/src/Client/ResourceClientInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException; -use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; @@ -121,14 +121,14 @@ public function upsertResource(string $uri, array $uriParameters = [], array $bo * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return Promise */ public function upsertAsyncResource( string $uri, array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface; + callable $onFail = null): Promise; /** * Creates and returns a resource if it does not exist yet, otherwise updates partially and returns the resource. @@ -159,7 +159,7 @@ public function upsertAsyncAndReturnPromise( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface; + callable $onFail = null): Promise; /** * Updates or creates several resources using a stream for the request and the response. @@ -189,14 +189,14 @@ public function upsertStreamResourceList(string $uri, array $uriParameters = [], * @throws HttpException If the request failed. * @throws InvalidArgumentException If the resources or any part thereof are invalid. * - * @return PromiseInterface returns a Promise + * @return Promise returns a Promise */ public function upsertAsyncStreamResourceList( string $uri, array $uriParameters = [], $resources = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface; + callable $onFail = null): Promise; /** * Updates or creates several resources using a single JSON string for the request and the response. @@ -224,14 +224,14 @@ public function upsertJsonResourceList(string $uri, array $uriParameters = [], a * @throws HttpException If the request failed. * @throws InvalidArgumentException If the resources or any part thereof are invalid. * - * @return PromiseInterface + * @return Promise */ public function upsertAsyncJsonResourceList( string $uri, array $uriParameters = [], array $resources = [], callable $onSuccess = null, - callable $onFail = null): PromiseInterface; + callable $onFail = null): Promise; /** * Deletes a resource. diff --git a/tests/Api/UpsertListProductTest.php b/tests/Api/UpsertListProductTest.php index ecad688b..79a40c9e 100644 --- a/tests/Api/UpsertListProductTest.php +++ b/tests/Api/UpsertListProductTest.php @@ -6,6 +6,7 @@ use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; use donatj\MockWebServer\ResponseStack; +use GuzzleHttp\Promise\Utils; use Http\Discovery\Psr17FactoryDiscovery; use PHPUnit\Framework\Assert; From 8dd94a43eafa2147d3b94d6fef5843efb5313bbf Mon Sep 17 00:00:00 2001 From: gwendalaubert Date: Mon, 26 Jun 2023 11:22:31 +0200 Subject: [PATCH 05/10] DX-104 : NOt used import line --- tests/Api/UpsertListProductTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Api/UpsertListProductTest.php b/tests/Api/UpsertListProductTest.php index 79a40c9e..ecad688b 100644 --- a/tests/Api/UpsertListProductTest.php +++ b/tests/Api/UpsertListProductTest.php @@ -6,7 +6,6 @@ use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; use donatj\MockWebServer\ResponseStack; -use GuzzleHttp\Promise\Utils; use Http\Discovery\Psr17FactoryDiscovery; use PHPUnit\Framework\Assert; From a4af16b8d005d867c887fdebdb9b2619b2f0777b Mon Sep 17 00:00:00 2001 From: gwendalaubert Date: Mon, 26 Jun 2023 14:07:55 +0200 Subject: [PATCH 06/10] DX-104 : Http/Promise => Guzzle/PromiseInterface --- src/Api/AppCatalog/AppCatalogApi.php | 4 ++-- src/Api/AppCatalog/AppCatalogApiInterface.php | 4 ++-- src/Api/AssetApi.php | 6 +++--- src/Api/AssetCategoryApi.php | 6 +++--- src/Api/AssetManager/AssetApi.php | 6 +++--- src/Api/AssetManager/AssetApiInterface.php | 6 +++--- src/Api/AssetManager/AssetAttributeApi.php | 4 ++-- src/Api/AssetManager/AssetAttributeApiInterface.php | 4 ++-- src/Api/AssetManager/AssetAttributeOptionApi.php | 4 ++-- .../AssetAttributeOptionApiInterface.php | 4 ++-- src/Api/AssetManager/AssetFamilyApi.php | 4 ++-- src/Api/AssetManager/AssetFamilyApiInterface.php | 4 ++-- src/Api/AssetTagApi.php | 4 ++-- src/Api/AssociationTypeApi.php | 6 +++--- src/Api/AttributeApi.php | 6 +++--- src/Api/AttributeGroupApi.php | 6 +++--- src/Api/AttributeOptionApi.php | 6 +++--- src/Api/AttributeOptionApiInterface.php | 6 +++--- src/Api/CategoryApi.php | 6 +++--- src/Api/ChannelApi.php | 6 +++--- src/Api/FamilyApi.php | 6 +++--- src/Api/FamilyVariantApi.php | 6 +++--- src/Api/FamilyVariantApiInterface.php | 6 +++--- src/Api/Operation/UpsertableResourceInterface.php | 4 ++-- .../Operation/UpsertableResourceListInterface.php | 4 ++-- src/Api/ProductApi.php | 6 +++--- src/Api/ProductModelApi.php | 6 +++--- src/Api/ProductUuidApi.php | 6 +++--- src/Api/ProductUuidApiInterface.php | 4 ++-- src/Api/ReferenceEntityApi.php | 4 ++-- src/Api/ReferenceEntityApiInterface.php | 4 ++-- src/Api/ReferenceEntityAttributeApi.php | 4 ++-- src/Api/ReferenceEntityAttributeApiInterface.php | 4 ++-- src/Api/ReferenceEntityAttributeOptionApi.php | 4 ++-- .../ReferenceEntityAttributeOptionApiInterface.php | 4 ++-- src/Api/ReferenceEntityRecordApi.php | 6 +++--- src/Api/ReferenceEntityRecordApiInterface.php | 6 +++--- src/Client/AuthenticatedHttpClient.php | 4 ++-- src/Client/CachedResourceClient.php | 10 +++++----- src/Client/ClientInterface.php | 4 ++-- src/Client/HttpClient.php | 4 ++-- src/Client/HttpClientInterface.php | 4 ++-- src/Client/ResourceClient.php | 12 ++++++------ src/Client/ResourceClientInterface.php | 10 +++++----- 44 files changed, 117 insertions(+), 117 deletions(-) diff --git a/src/Api/AppCatalog/AppCatalogApi.php b/src/Api/AppCatalog/AppCatalogApi.php index 07abfb9f..93d9d188 100644 --- a/src/Api/AppCatalog/AppCatalogApi.php +++ b/src/Api/AppCatalog/AppCatalogApi.php @@ -10,7 +10,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -62,7 +62,7 @@ public function delete(string $code): int return $this->resourceClient->deleteResource(static::APP_CATALOG_URI, [$code]); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncAndReturnPromise(static::APP_CATALOG_URI, [$code], $data, $onSuccess, $onFail); } diff --git a/src/Api/AppCatalog/AppCatalogApiInterface.php b/src/Api/AppCatalog/AppCatalogApiInterface.php index 7204d3eb..756e064a 100644 --- a/src/Api/AppCatalog/AppCatalogApiInterface.php +++ b/src/Api/AppCatalog/AppCatalogApiInterface.php @@ -7,7 +7,7 @@ use Akeneo\Pim\ApiClient\Api\Operation\DeletableResourceInterface; use Akeneo\Pim\ApiClient\Api\Operation\GettableResourceInterface; use Akeneo\Pim\ApiClient\Api\Operation\ListableResourceInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -21,5 +21,5 @@ interface AppCatalogApiInterface extends public function create(array $data): array; public function upsert(string $code, array $data = []): array; - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/AssetApi.php b/src/Api/AssetApi.php index eb1a872f..ec807c53 100644 --- a/src/Api/AssetApi.php +++ b/src/Api/AssetApi.php @@ -10,7 +10,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -91,7 +91,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSET_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::ASSET_URI, [$code], $data, $onSuccess, $onFail); } @@ -104,7 +104,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ASSETS_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncStreamResourceList(self::ASSETS_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/AssetCategoryApi.php b/src/Api/AssetCategoryApi.php index 03c4958d..40857c28 100644 --- a/src/Api/AssetCategoryApi.php +++ b/src/Api/AssetCategoryApi.php @@ -10,7 +10,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -76,7 +76,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSET_CATEGORY_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::ASSET_CATEGORY_URI, [$code], $data, $onSuccess, $onFail); } @@ -103,7 +103,7 @@ public function create(string $code, array $data = []): int return $this->resourceClient->createResource(static::ASSET_CATEGORIES_URI, [], $data); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncStreamResourceList(static::ASSET_CATEGORIES_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/AssetManager/AssetApi.php b/src/Api/AssetManager/AssetApi.php index deb569ef..289114c8 100644 --- a/src/Api/AssetManager/AssetApi.php +++ b/src/Api/AssetManager/AssetApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; class AssetApi implements AssetApiInterface { @@ -75,7 +75,7 @@ public function delete(string $assetFamilyCode, string $assetCode): int /** * {@inheritdoc} */ - public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::ASSET_URI, [$assetFamilyCode, $assetCode], $data, $onSuccess, $onFail); } @@ -83,7 +83,7 @@ public function upsertAsync(string $assetFamilyCode, string $assetCode, array $d /** * {@inheritdoc} */ - public function upsertAsyncList(string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsyncList(string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncJsonResourceList(static::ASSETS_URI, [$assetFamilyCode], $assets, $onSuccess, $onFail); } diff --git a/src/Api/AssetManager/AssetApiInterface.php b/src/Api/AssetManager/AssetApiInterface.php index f11dafd7..92ec39e7 100644 --- a/src/Api/AssetManager/AssetApiInterface.php +++ b/src/Api/AssetManager/AssetApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; interface AssetApiInterface { @@ -64,7 +64,7 @@ public function upsertList(string $assetFamilyCode, array $assets): array; * * @return Promise */ - public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; /** * Updates or creates several assets. @@ -76,7 +76,7 @@ public function upsertAsync(string $assetFamilyCode, string $assetCode, array $d * * @return Promise */ - public function upsertAsyncList(string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsyncList(string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): PromiseInterface; /** * Deletes an asset. diff --git a/src/Api/AssetManager/AssetAttributeApi.php b/src/Api/AssetManager/AssetAttributeApi.php index 615d15da..76c95a62 100644 --- a/src/Api/AssetManager/AssetAttributeApi.php +++ b/src/Api/AssetManager/AssetAttributeApi.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; class AssetAttributeApi implements AssetAttributeApiInterface { @@ -44,7 +44,7 @@ public function upsert(string $assetFamilyCode, string $attributeCode, array $da /** * {@inheritdoc} */ - public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::ASSET_ATTRIBUTE_URI, [$assetFamilyCode, $attributeCode], $data, $onSuccess, $onFail); } diff --git a/src/Api/AssetManager/AssetAttributeApiInterface.php b/src/Api/AssetManager/AssetAttributeApiInterface.php index 75060df8..a231ae06 100644 --- a/src/Api/AssetManager/AssetAttributeApiInterface.php +++ b/src/Api/AssetManager/AssetAttributeApiInterface.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Exception\HttpException; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; interface AssetAttributeApiInterface { @@ -40,5 +40,5 @@ public function upsert(string $assetFamilyCode, string $attributeCode, array $da * * @return Promise */ - public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/AssetManager/AssetAttributeOptionApi.php b/src/Api/AssetManager/AssetAttributeOptionApi.php index fcb2db5a..8ef6a16d 100644 --- a/src/Api/AssetManager/AssetAttributeOptionApi.php +++ b/src/Api/AssetManager/AssetAttributeOptionApi.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; class AssetAttributeOptionApi implements AssetAttributeOptionApiInterface { @@ -51,7 +51,7 @@ public function upsert(string $assetFamilyCode, string $attributeCode, string $a ); } - public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): Promise + public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource( static::ASSET_ATTRIBUTE_OPTION_URI, diff --git a/src/Api/AssetManager/AssetAttributeOptionApiInterface.php b/src/Api/AssetManager/AssetAttributeOptionApiInterface.php index c328b161..7ac6b09a 100644 --- a/src/Api/AssetManager/AssetAttributeOptionApiInterface.php +++ b/src/Api/AssetManager/AssetAttributeOptionApiInterface.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; use Akeneo\Pim\ApiClient\Exception\HttpException; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; interface AssetAttributeOptionApiInterface { @@ -40,5 +40,5 @@ public function upsert(string $assetFamilyCode, string $attributeCode, string $a * * @return Promise */ - public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/AssetManager/AssetFamilyApi.php b/src/Api/AssetManager/AssetFamilyApi.php index f87be7b8..31fbf428 100644 --- a/src/Api/AssetManager/AssetFamilyApi.php +++ b/src/Api/AssetManager/AssetFamilyApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; class AssetFamilyApi implements AssetFamilyApiInterface { @@ -59,7 +59,7 @@ public function upsert(string $code, array $data = []): int /** * {@inheritdoc} */ - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::ASSET_FAMILY_URI, [$code], $data, $onSuccess, $onFail); } diff --git a/src/Api/AssetManager/AssetFamilyApiInterface.php b/src/Api/AssetManager/AssetFamilyApiInterface.php index cc4a03c3..43f71a34 100644 --- a/src/Api/AssetManager/AssetFamilyApiInterface.php +++ b/src/Api/AssetManager/AssetFamilyApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; interface AssetFamilyApiInterface { @@ -41,5 +41,5 @@ public function upsert(string $assetFamilyCode, array $data = []): int; * * @return Promise */ - public function upsertAsync(string $assetFamilyCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsync(string $assetFamilyCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/AssetTagApi.php b/src/Api/AssetTagApi.php index 61f19313..c43f6f97 100644 --- a/src/Api/AssetTagApi.php +++ b/src/Api/AssetTagApi.php @@ -9,7 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; /** * API implementation to manage asset tags. @@ -73,7 +73,7 @@ public function listPerPage(int $limit = 100, bool $withCount = false, array $qu return $this->pageFactory->createPage($data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::ASSET_TAG_URI, [$code], $data, $onSuccess, $onFail); } diff --git a/src/Api/AssociationTypeApi.php b/src/Api/AssociationTypeApi.php index 3e6fe10c..a881b13b 100644 --- a/src/Api/AssociationTypeApi.php +++ b/src/Api/AssociationTypeApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -77,7 +77,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSOCIATION_TYPE_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::ASSOCIATION_TYPE_URI, [$code], $data, $onSuccess, $onFail); } @@ -90,7 +90,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ASSOCIATION_TYPES_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncStreamResourceList(static::ASSOCIATION_TYPES_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/AttributeApi.php b/src/Api/AttributeApi.php index 46451d64..c0f71975 100644 --- a/src/Api/AttributeApi.php +++ b/src/Api/AttributeApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +80,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ATTRIBUTE_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_URI, [$code], $data, $onSuccess, $onFail); } @@ -93,7 +93,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTES_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTES_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/AttributeGroupApi.php b/src/Api/AttributeGroupApi.php index 7144961f..f60e13d3 100644 --- a/src/Api/AttributeGroupApi.php +++ b/src/Api/AttributeGroupApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +80,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ATTRIBUTE_GROUP_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_GROUP_URI, [$code], $data, $onSuccess, $onFail); } @@ -93,7 +93,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTE_GROUPS_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTE_GROUPS_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/AttributeOptionApi.php b/src/Api/AttributeOptionApi.php index a049984f..3b577bca 100644 --- a/src/Api/AttributeOptionApi.php +++ b/src/Api/AttributeOptionApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; /** * API implementation to manage the attribute options. @@ -93,12 +93,12 @@ public function upsertList($attributeCode, $attributeOptions): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions); } - public function upsertAsyncList($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsyncList($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions, $onSuccess, $onFail); } - public function upsertAsync($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_OPTION_URI, [$attributeCode, $attributeOptionCode], $data, $onSuccess, $onFail); } diff --git a/src/Api/AttributeOptionApiInterface.php b/src/Api/AttributeOptionApiInterface.php index e8e95bd9..af6136df 100644 --- a/src/Api/AttributeOptionApiInterface.php +++ b/src/Api/AttributeOptionApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException; use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -99,7 +99,7 @@ public function upsert($attributeCode, $attributeOptionCode, array $data = []): * * @return Promise */ - public function upsertAsync($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsync($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; /** * Updates or creates several attribute options at once. @@ -123,5 +123,5 @@ public function upsertList($attributeCode, $attributeOptions): \Traversable; * * @return Promise */ - public function upsertAsyncList($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsyncList($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/CategoryApi.php b/src/Api/CategoryApi.php index 9d6b124e..3308a311 100644 --- a/src/Api/CategoryApi.php +++ b/src/Api/CategoryApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +80,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::CATEGORY_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::CATEGORY_URI, [$code], $data, $onSuccess, $onFail); } @@ -93,7 +93,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::CATEGORIES_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncStreamResourceList(static::CATEGORIES_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/ChannelApi.php b/src/Api/ChannelApi.php index 8bd53a54..4530dac4 100644 --- a/src/Api/ChannelApi.php +++ b/src/Api/ChannelApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +80,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::CHANNEL_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::CHANNEL_URI, [$code], $data, $onSuccess, $onFail); } @@ -93,7 +93,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::CHANNELS_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncStreamResourceList(static::CHANNELS_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/FamilyApi.php b/src/Api/FamilyApi.php index 43fba8d2..67a77d21 100644 --- a/src/Api/FamilyApi.php +++ b/src/Api/FamilyApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +80,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::FAMILY_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::FAMILY_URI, [$code], $data, $onSuccess, $onFail); } @@ -93,7 +93,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::FAMILIES_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncStreamResourceList(static::FAMILIES_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/FamilyVariantApi.php b/src/Api/FamilyVariantApi.php index 24d08ac8..9cdba5d6 100644 --- a/src/Api/FamilyVariantApi.php +++ b/src/Api/FamilyVariantApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; /** * Api implementation to manages Family Variants @@ -106,7 +106,7 @@ public function upsertList($familyCode, $familyVariants): \Traversable /** * {@inheritdoc} */ - public function upsertAsync($familyCode, $familyVariantCode, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): Promise + public function upsertAsync($familyCode, $familyVariantCode, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): PromiseInterface { if (array_key_exists('family', $data)) { throw new InvalidArgumentException('The parameter "family" must not be defined in the data parameter'); @@ -122,7 +122,7 @@ public function upsertAsync($familyCode, $familyVariantCode, array $data = [], ? /** * {@inheritdoc} */ - public function upsertAsyncList($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsyncList($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncStreamResourceList(static::FAMILY_VARIANTS_URI, [$familyCode], $familyVariants, $onSuccess, $onFail); } diff --git a/src/Api/FamilyVariantApiInterface.php b/src/Api/FamilyVariantApiInterface.php index e71336ab..b6374a67 100644 --- a/src/Api/FamilyVariantApiInterface.php +++ b/src/Api/FamilyVariantApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException; use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -75,7 +75,7 @@ public function upsert($familyCode, $familyVariantCode, array $data = []): int; * * @return Promise */ - public function upsertAsync($familyCode, $familyVariantCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsync($familyCode, $familyVariantCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; /** * Available since Akeneo PIM 2.0. @@ -134,5 +134,5 @@ public function upsertList($familyCode, $familyVariants): \Traversable; * * @return Promise */ - public function upsertAsyncList($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsyncList($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/Operation/UpsertableResourceInterface.php b/src/Api/Operation/UpsertableResourceInterface.php index a9afe222..cbba6c05 100644 --- a/src/Api/Operation/UpsertableResourceInterface.php +++ b/src/Api/Operation/UpsertableResourceInterface.php @@ -3,7 +3,7 @@ namespace Akeneo\Pim\ApiClient\Api\Operation; use Akeneo\Pim\ApiClient\Exception\HttpException; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; /** * API that can "upsert" a resource. @@ -37,5 +37,5 @@ public function upsert(string $code, array $data = []): int; * * @return Promise */ - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/Operation/UpsertableResourceListInterface.php b/src/Api/Operation/UpsertableResourceListInterface.php index 53c43b06..07c8d1ab 100644 --- a/src/Api/Operation/UpsertableResourceListInterface.php +++ b/src/Api/Operation/UpsertableResourceListInterface.php @@ -3,7 +3,7 @@ namespace Akeneo\Pim\ApiClient\Api\Operation; use Akeneo\Pim\ApiClient\Exception\HttpException; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -35,5 +35,5 @@ public function upsertList(array|StreamInterface $resources): \Traversable; * * @return Promise returns a Promise */ - public function upsertAsyncList(array|StreamInterface $resources, callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsyncList(array|StreamInterface $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/ProductApi.php b/src/Api/ProductApi.php index f22bad86..edc61f0f 100644 --- a/src/Api/ProductApi.php +++ b/src/Api/ProductApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -82,7 +82,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::PRODUCT_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::PRODUCT_URI, [$code], $data, $onSuccess, $onFail); } @@ -103,7 +103,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::PRODUCTS_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCTS_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/ProductModelApi.php b/src/Api/ProductModelApi.php index 292663d9..022ad2d7 100644 --- a/src/Api/ProductModelApi.php +++ b/src/Api/ProductModelApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -116,7 +116,7 @@ public function delete(string $code): int return $this->resourceClient->deleteResource(static::PRODUCT_MODEL_URI, [$code]); } - public function upsertAsync(string $code, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): Promise + public function upsertAsync(string $code, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): PromiseInterface { if (array_key_exists('code', $data)) { throw new InvalidArgumentException('The parameter "code" must not be defined in the data parameter'); @@ -127,7 +127,7 @@ public function upsertAsync(string $code, array $data = [], ?callable $onSuccess return $this->resourceClient->upsertAsyncResource(static::PRODUCT_MODEL_URI, [$code], $data); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCT_MODELS_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/ProductUuidApi.php b/src/Api/ProductUuidApi.php index b669079b..dd662d69 100644 --- a/src/Api/ProductUuidApi.php +++ b/src/Api/ProductUuidApi.php @@ -10,7 +10,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\StreamInterface; /** @@ -65,7 +65,7 @@ public function upsert(string $uuid, array $data = []): int return $this->resourceClient->upsertResource(static::PRODUCT_UUID_URI, [$uuid], $data); } - public function upsertAsync(string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::PRODUCT_UUID_URI, [$uuid], $data, $onSuccess, $onFail); } @@ -80,7 +80,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::PRODUCTS_UUID_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCTS_UUID_URI, [], $resources, $onSuccess, $onFail); } diff --git a/src/Api/ProductUuidApiInterface.php b/src/Api/ProductUuidApiInterface.php index 5052febe..f69d8f1d 100644 --- a/src/Api/ProductUuidApiInterface.php +++ b/src/Api/ProductUuidApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Api\Operation\ListableResourceInterface; use Akeneo\Pim\ApiClient\Api\Operation\UpsertableResourceListInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -20,7 +20,7 @@ public function create(string $uuid, array $data = []): int; public function upsert(string $uuid, array $data = []): int; - public function upsertAsync(string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsync(string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; public function delete(string $uuid): int; } diff --git a/src/Api/ReferenceEntityApi.php b/src/Api/ReferenceEntityApi.php index f67e7026..8059feb1 100644 --- a/src/Api/ReferenceEntityApi.php +++ b/src/Api/ReferenceEntityApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; /** * @author Tamara Robichet @@ -61,7 +61,7 @@ public function upsert(string $referenceEntityCode, array $data = []): int return $this->resourceClient->upsertResource(static::REFERENCE_ENTITY_URI, [$referenceEntityCode], $data); } - public function upsertAsync(string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_URI, [$referenceEntityCode], $data, $onSuccess, $onFail); } diff --git a/src/Api/ReferenceEntityApiInterface.php b/src/Api/ReferenceEntityApiInterface.php index b77bab16..0a71204a 100644 --- a/src/Api/ReferenceEntityApiInterface.php +++ b/src/Api/ReferenceEntityApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; /** * API to manage the reference entities. @@ -62,5 +62,5 @@ public function upsert(string $referenceEntityCode, array $data = []): int; * * @return Promise */ - public function upsertAsync(string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsync(string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/ReferenceEntityAttributeApi.php b/src/Api/ReferenceEntityAttributeApi.php index cedcdc0f..a11dc687 100644 --- a/src/Api/ReferenceEntityAttributeApi.php +++ b/src/Api/ReferenceEntityAttributeApi.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; /** * @author Laurent Petard @@ -49,7 +49,7 @@ public function upsert(string $referenceEntityCode, string $attributeCode, array /** * {@inheritdoc} */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_ATTRIBUTE_URI, [$referenceEntityCode, $attributeCode], $data, $onSuccess, $onFail); } diff --git a/src/Api/ReferenceEntityAttributeApiInterface.php b/src/Api/ReferenceEntityAttributeApiInterface.php index 3250377d..72c0ee3b 100644 --- a/src/Api/ReferenceEntityAttributeApiInterface.php +++ b/src/Api/ReferenceEntityAttributeApiInterface.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Exception\HttpException; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; /** * @author Laurent Petard @@ -63,5 +63,5 @@ public function upsert(string $referenceEntityCode, string $attributeCode, array * * @return Promise */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/ReferenceEntityAttributeOptionApi.php b/src/Api/ReferenceEntityAttributeOptionApi.php index fd628e9d..c3708b26 100644 --- a/src/Api/ReferenceEntityAttributeOptionApi.php +++ b/src/Api/ReferenceEntityAttributeOptionApi.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; /** * @author Laurent Petard @@ -59,7 +59,7 @@ public function upsert(string $referenceEntityCode, string $attributeCode, strin /** * {@inheritdoc} */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): Promise + public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource( static::REFERENCE_ENTITY_ATTRIBUTE_OPTION_URI, diff --git a/src/Api/ReferenceEntityAttributeOptionApiInterface.php b/src/Api/ReferenceEntityAttributeOptionApiInterface.php index 9358f943..addc1d2d 100644 --- a/src/Api/ReferenceEntityAttributeOptionApiInterface.php +++ b/src/Api/ReferenceEntityAttributeOptionApiInterface.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Api; use Akeneo\Pim\ApiClient\Exception\HttpException; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; /** * @author Laurent Petard @@ -66,5 +66,5 @@ public function upsert(string $referenceEntityCode, string $attributeCode, strin * * @return Promise */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Api/ReferenceEntityRecordApi.php b/src/Api/ReferenceEntityRecordApi.php index cd0a7d3e..8a58600c 100644 --- a/src/Api/ReferenceEntityRecordApi.php +++ b/src/Api/ReferenceEntityRecordApi.php @@ -8,7 +8,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; /** * @author Laurent Petard @@ -69,12 +69,12 @@ public function upsertList(string $referenceEntityCode, array $records): array return $this->resourceClient->upsertJsonResourceList(static::REFERENCE_ENTITY_RECORDS_URI, [$referenceEntityCode], $records); } - public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_RECORD_URI, [$referenceEntityCode, $recordCode], $data, $onSuccess, $onFail); } - public function upsertAsyncList(string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): Promise + public function upsertAsyncList(string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncJsonResourceList(static::REFERENCE_ENTITY_RECORDS_URI, [$referenceEntityCode], $records, $onSuccess, $onFail); } diff --git a/src/Api/ReferenceEntityRecordApiInterface.php b/src/Api/ReferenceEntityRecordApiInterface.php index 54dbf32d..aca42740 100644 --- a/src/Api/ReferenceEntityRecordApiInterface.php +++ b/src/Api/ReferenceEntityRecordApiInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; /** * API to mange the reference entity records. @@ -66,7 +66,7 @@ public function upsert(string $referenceEntityCode, string $recordCode, array $d * * @return Promise */ - public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; /** * Updates or creates several reference entity records. @@ -90,5 +90,5 @@ public function upsertList(string $referenceEntityCode, array $records): array; * * @return Promise */ - public function upsertAsyncList(string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): Promise; + public function upsertAsyncList(string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): PromiseInterface; } diff --git a/src/Client/AuthenticatedHttpClient.php b/src/Client/AuthenticatedHttpClient.php index e007b448..139d3d08 100644 --- a/src/Client/AuthenticatedHttpClient.php +++ b/src/Client/AuthenticatedHttpClient.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\UnauthorizedHttpException; use Akeneo\Pim\ApiClient\Exception\UnprocessableEntityHttpException; use Akeneo\Pim\ApiClient\Security\Authentication; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\ResponseInterface; /** @@ -84,7 +84,7 @@ public function sendAsync( array $headers = [], $body = null, callable $onSuccess = null, - callable $onFail = null): Promise + callable $onFail = null): PromiseInterface { if (null === $this->authentication->getAccessToken()) { $tokens = $this->authenticationApi->authenticateByPassword( diff --git a/src/Client/CachedResourceClient.php b/src/Client/CachedResourceClient.php index b9efe716..366a409b 100644 --- a/src/Client/CachedResourceClient.php +++ b/src/Client/CachedResourceClient.php @@ -5,7 +5,7 @@ namespace Akeneo\Pim\ApiClient\Client; use Akeneo\Pim\ApiClient\Cache\CacheInterface; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\ResponseInterface; /** @@ -79,7 +79,7 @@ public function upsertAsyncResource( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): Promise + callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncResource($uri, $uriParameters, $body, $onSuccess, $onFail); } @@ -97,7 +97,7 @@ public function upsertAsyncStreamResourceList( array $uriParameters = [], $resources = [], callable $onSuccess = null, - callable $onFail = null): Promise + callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncStreamResourceList($uri, $uriParameters, $resources, $onSuccess, $onFail); } @@ -115,7 +115,7 @@ public function upsertAsyncJsonResourceList( array $uriParameters = [], array $resources = [], callable $onSuccess = null, - callable $onFail = null): Promise + callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncJsonResourceList($uri, $uriParameters, $resources, $onSuccess, $onFail); } @@ -157,7 +157,7 @@ public function upsertAsyncAndReturnPromise( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): Promise + callable $onFail = null): PromiseInterface { return $this->resourceClient->upsertAsyncAndReturnPromise($uri, $uriParameters, $body, $onSuccess, $onFail); } diff --git a/src/Client/ClientInterface.php b/src/Client/ClientInterface.php index eae91f47..fc864fa7 100644 --- a/src/Client/ClientInterface.php +++ b/src/Client/ClientInterface.php @@ -4,11 +4,11 @@ namespace Akeneo\Pim\ApiClient\Client; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Client\ClientInterface as BaseClientInterface; use Psr\Http\Message\RequestInterface; interface ClientInterface extends BaseClientInterface { - public function sendAsyncRequest(RequestInterface $request): Promise; + public function sendAsyncRequest(RequestInterface $request): PromiseInterface; } diff --git a/src/Client/HttpClient.php b/src/Client/HttpClient.php index 76e587d1..9bc4f438 100644 --- a/src/Client/HttpClient.php +++ b/src/Client/HttpClient.php @@ -2,7 +2,7 @@ namespace Akeneo\Pim\ApiClient\Client; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\RequestFactoryInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -83,7 +83,7 @@ public function sendAsync( array $headers = [], $body = null, callable $onSuccess = null, - callable $onFail = null): Promise + callable $onFail = null): PromiseInterface { $request = $this->prepareRequest($httpMethod, $uri, $headers, $body); diff --git a/src/Client/HttpClientInterface.php b/src/Client/HttpClientInterface.php index e74d9fbe..1ba9408e 100644 --- a/src/Client/HttpClientInterface.php +++ b/src/Client/HttpClientInterface.php @@ -3,7 +3,7 @@ namespace Akeneo\Pim\ApiClient\Client; use Akeneo\Pim\ApiClient\Exception\HttpException; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; use Psr\Http\Message\UriInterface; @@ -51,5 +51,5 @@ public function sendAsync( array $headers = [], $body = null, callable $onSuccess = null, - callable $onFail = null): Promise; + callable $onFail = null): PromiseInterface; } diff --git a/src/Client/ResourceClient.php b/src/Client/ResourceClient.php index 6bc7141c..79e58fd9 100644 --- a/src/Client/ResourceClient.php +++ b/src/Client/ResourceClient.php @@ -9,7 +9,7 @@ use Akeneo\Pim\ApiClient\Routing\UriGeneratorInterface; use Akeneo\Pim\ApiClient\Stream\MultipartStreamBuilderFactory; use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponseFactory; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; @@ -130,7 +130,7 @@ public function upsertAsyncResource( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): Promise + callable $onFail = null): PromiseInterface { return $this->sendAsyncUpsertRequest($uri, $uriParameters, $body, $onSuccess, $onFail); } @@ -150,7 +150,7 @@ public function upsertAsyncAndReturnPromise( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): Promise + callable $onFail = null): PromiseInterface { return $this->sendAsyncUpsertRequest($uri, $uriParameters, $body, $onSuccess, $onFail); } @@ -201,7 +201,7 @@ public function upsertAsyncStreamResourceList( array $uriParameters = [], $resources = [], callable $onSuccess = null, - callable $onFail = null): Promise + callable $onFail = null): PromiseInterface { $body = $this->prepareResourceListRequest($resources); $uri = $this->uriGenerator->generate($uri, $uriParameters); @@ -241,7 +241,7 @@ public function upsertAsyncJsonResourceList( array $uriParameters = [], array $resources = [], callable $onSuccess = null, - callable $onFail = null): Promise + callable $onFail = null): PromiseInterface { $uri = $this->uriGenerator->generate($uri, $uriParameters); return $this->httpClient->sendAsync( @@ -309,7 +309,7 @@ private function sendAsyncUpsertRequest( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): Promise + callable $onFail = null): PromiseInterface { unset($body['_links']); diff --git a/src/Client/ResourceClientInterface.php b/src/Client/ResourceClientInterface.php index d4698594..93cb746f 100644 --- a/src/Client/ResourceClientInterface.php +++ b/src/Client/ResourceClientInterface.php @@ -6,7 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException; -use Http\Promise\Promise; +use GuzzleHttp\Promise\PromiseInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; @@ -128,7 +128,7 @@ public function upsertAsyncResource( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): Promise; + callable $onFail = null): PromiseInterface; /** * Creates and returns a resource if it does not exist yet, otherwise updates partially and returns the resource. @@ -159,7 +159,7 @@ public function upsertAsyncAndReturnPromise( array $uriParameters = [], array $body = [], callable $onSuccess = null, - callable $onFail = null): Promise; + callable $onFail = null): PromiseInterface; /** * Updates or creates several resources using a stream for the request and the response. @@ -196,7 +196,7 @@ public function upsertAsyncStreamResourceList( array $uriParameters = [], $resources = [], callable $onSuccess = null, - callable $onFail = null): Promise; + callable $onFail = null): PromiseInterface; /** * Updates or creates several resources using a single JSON string for the request and the response. @@ -231,7 +231,7 @@ public function upsertAsyncJsonResourceList( array $uriParameters = [], array $resources = [], callable $onSuccess = null, - callable $onFail = null): Promise; + callable $onFail = null): PromiseInterface; /** * Deletes a resource. From 56ff280619dc7487f6e91a2463bd50735e67860b Mon Sep 17 00:00:00 2001 From: gwendalaubert Date: Mon, 26 Jun 2023 16:49:34 +0200 Subject: [PATCH 07/10] DX-104 : Rollback on callback as it can be handled after the call --- src/Api/AppCatalog/AppCatalogApi.php | 4 +-- src/Api/AppCatalog/AppCatalogApiInterface.php | 2 +- src/Api/AssetApi.php | 8 ++--- src/Api/AssetCategoryApi.php | 8 ++--- src/Api/AssetManager/AssetApi.php | 8 ++--- src/Api/AssetManager/AssetApiInterface.php | 4 +-- src/Api/AssetManager/AssetAttributeApi.php | 4 +-- .../AssetAttributeApiInterface.php | 2 +- .../AssetAttributeOptionApiInterface.php | 2 +- src/Api/AssetManager/AssetFamilyApi.php | 4 +-- .../AssetManager/AssetFamilyApiInterface.php | 2 +- src/Api/AssetTagApi.php | 4 +-- src/Api/AssociationTypeApi.php | 8 ++--- src/Api/AttributeApi.php | 8 ++--- src/Api/AttributeGroupApi.php | 8 ++--- src/Api/AttributeOptionApi.php | 8 ++--- src/Api/AttributeOptionApiInterface.php | 4 +-- src/Api/CategoryApi.php | 8 ++--- src/Api/ChannelApi.php | 8 ++--- src/Api/FamilyApi.php | 8 ++--- src/Api/FamilyVariantApi.php | 4 +-- src/Api/FamilyVariantApiInterface.php | 4 +-- .../Operation/UpsertableResourceInterface.php | 2 +- .../UpsertableResourceListInterface.php | 2 +- src/Api/ProductApi.php | 8 ++--- src/Api/ProductModelApi.php | 4 +-- src/Api/ProductUuidApi.php | 8 ++--- src/Api/ProductUuidApiInterface.php | 2 +- src/Api/ReferenceEntityApi.php | 4 +-- src/Api/ReferenceEntityApiInterface.php | 2 +- src/Api/ReferenceEntityAttributeApi.php | 4 +-- .../ReferenceEntityAttributeApiInterface.php | 2 +- ...renceEntityAttributeOptionApiInterface.php | 2 +- src/Api/ReferenceEntityRecordApi.php | 8 ++--- src/Api/ReferenceEntityRecordApiInterface.php | 4 +-- src/Client/AuthenticatedHttpClient.php | 8 ++--- src/Client/CachedResourceClient.php | 24 +++++-------- src/Client/HttpClient.php | 4 +-- src/Client/HttpClientInterface.php | 6 ++-- src/Client/ResourceClient.php | 36 ++++++------------- src/Client/ResourceClientInterface.php | 16 +++------ 41 files changed, 114 insertions(+), 152 deletions(-) diff --git a/src/Api/AppCatalog/AppCatalogApi.php b/src/Api/AppCatalog/AppCatalogApi.php index 93d9d188..6ec9b3bb 100644 --- a/src/Api/AppCatalog/AppCatalogApi.php +++ b/src/Api/AppCatalog/AppCatalogApi.php @@ -62,8 +62,8 @@ public function delete(string $code): int return $this->resourceClient->deleteResource(static::APP_CATALOG_URI, [$code]); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncAndReturnPromise(static::APP_CATALOG_URI, [$code], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncAndReturnPromise(static::APP_CATALOG_URI, [$code], $data); } } diff --git a/src/Api/AppCatalog/AppCatalogApiInterface.php b/src/Api/AppCatalog/AppCatalogApiInterface.php index 756e064a..d07d9102 100644 --- a/src/Api/AppCatalog/AppCatalogApiInterface.php +++ b/src/Api/AppCatalog/AppCatalogApiInterface.php @@ -21,5 +21,5 @@ interface AppCatalogApiInterface extends public function create(array $data): array; public function upsert(string $code, array $data = []): array; - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $code, array $data = []): PromiseInterface; } diff --git a/src/Api/AssetApi.php b/src/Api/AssetApi.php index ec807c53..fec4bb73 100644 --- a/src/Api/AssetApi.php +++ b/src/Api/AssetApi.php @@ -91,9 +91,9 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSET_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::ASSET_URI, [$code], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::ASSET_URI, [$code], $data); } /** @@ -104,8 +104,8 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ASSETS_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface { - return $this->resourceClient->upsertAsyncStreamResourceList(self::ASSETS_URI, [], $resources, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncStreamResourceList(self::ASSETS_URI, [], $resources); } } diff --git a/src/Api/AssetCategoryApi.php b/src/Api/AssetCategoryApi.php index 40857c28..1bab01a2 100644 --- a/src/Api/AssetCategoryApi.php +++ b/src/Api/AssetCategoryApi.php @@ -76,9 +76,9 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSET_CATEGORY_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::ASSET_CATEGORY_URI, [$code], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::ASSET_CATEGORY_URI, [$code], $data); } /** @@ -103,8 +103,8 @@ public function create(string $code, array $data = []): int return $this->resourceClient->createResource(static::ASSET_CATEGORIES_URI, [], $data); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface { - return $this->resourceClient->upsertAsyncStreamResourceList(static::ASSET_CATEGORIES_URI, [], $resources, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncStreamResourceList(static::ASSET_CATEGORIES_URI, [], $resources); } } diff --git a/src/Api/AssetManager/AssetApi.php b/src/Api/AssetManager/AssetApi.php index 289114c8..8014881c 100644 --- a/src/Api/AssetManager/AssetApi.php +++ b/src/Api/AssetManager/AssetApi.php @@ -75,16 +75,16 @@ public function delete(string $assetFamilyCode, string $assetCode): int /** * {@inheritdoc} */ - public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::ASSET_URI, [$assetFamilyCode, $assetCode], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::ASSET_URI, [$assetFamilyCode, $assetCode], $data); } /** * {@inheritdoc} */ - public function upsertAsyncList(string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(string $assetFamilyCode, array $assets): PromiseInterface { - return $this->resourceClient->upsertAsyncJsonResourceList(static::ASSETS_URI, [$assetFamilyCode], $assets, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncJsonResourceList(static::ASSETS_URI, [$assetFamilyCode], $assets); } } diff --git a/src/Api/AssetManager/AssetApiInterface.php b/src/Api/AssetManager/AssetApiInterface.php index 92ec39e7..fde256dd 100644 --- a/src/Api/AssetManager/AssetApiInterface.php +++ b/src/Api/AssetManager/AssetApiInterface.php @@ -64,7 +64,7 @@ public function upsertList(string $assetFamilyCode, array $assets): array; * * @return Promise */ - public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = []): PromiseInterface; /** * Updates or creates several assets. @@ -76,7 +76,7 @@ public function upsertAsync(string $assetFamilyCode, string $assetCode, array $d * * @return Promise */ - public function upsertAsyncList(string $assetFamilyCode, array $assets, callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsyncList(string $assetFamilyCode, array $assets): PromiseInterface; /** * Deletes an asset. diff --git a/src/Api/AssetManager/AssetAttributeApi.php b/src/Api/AssetManager/AssetAttributeApi.php index 76c95a62..3965319b 100644 --- a/src/Api/AssetManager/AssetAttributeApi.php +++ b/src/Api/AssetManager/AssetAttributeApi.php @@ -44,8 +44,8 @@ public function upsert(string $assetFamilyCode, string $attributeCode, array $da /** * {@inheritdoc} */ - public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::ASSET_ATTRIBUTE_URI, [$assetFamilyCode, $attributeCode], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::ASSET_ATTRIBUTE_URI, [$assetFamilyCode, $attributeCode], $data); } } diff --git a/src/Api/AssetManager/AssetAttributeApiInterface.php b/src/Api/AssetManager/AssetAttributeApiInterface.php index a231ae06..9e54b8c7 100644 --- a/src/Api/AssetManager/AssetAttributeApiInterface.php +++ b/src/Api/AssetManager/AssetAttributeApiInterface.php @@ -40,5 +40,5 @@ public function upsert(string $assetFamilyCode, string $attributeCode, array $da * * @return Promise */ - public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = []): PromiseInterface; } diff --git a/src/Api/AssetManager/AssetAttributeOptionApiInterface.php b/src/Api/AssetManager/AssetAttributeOptionApiInterface.php index 7ac6b09a..37fcc214 100644 --- a/src/Api/AssetManager/AssetAttributeOptionApiInterface.php +++ b/src/Api/AssetManager/AssetAttributeOptionApiInterface.php @@ -40,5 +40,5 @@ public function upsert(string $assetFamilyCode, string $attributeCode, string $a * * @return Promise */ - public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface; } diff --git a/src/Api/AssetManager/AssetFamilyApi.php b/src/Api/AssetManager/AssetFamilyApi.php index 31fbf428..0a5805a6 100644 --- a/src/Api/AssetManager/AssetFamilyApi.php +++ b/src/Api/AssetManager/AssetFamilyApi.php @@ -59,8 +59,8 @@ public function upsert(string $code, array $data = []): int /** * {@inheritdoc} */ - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::ASSET_FAMILY_URI, [$code], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::ASSET_FAMILY_URI, [$code], $data); } } diff --git a/src/Api/AssetManager/AssetFamilyApiInterface.php b/src/Api/AssetManager/AssetFamilyApiInterface.php index 43f71a34..fe9d9dd5 100644 --- a/src/Api/AssetManager/AssetFamilyApiInterface.php +++ b/src/Api/AssetManager/AssetFamilyApiInterface.php @@ -41,5 +41,5 @@ public function upsert(string $assetFamilyCode, array $data = []): int; * * @return Promise */ - public function upsertAsync(string $assetFamilyCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, array $data = []): PromiseInterface; } diff --git a/src/Api/AssetTagApi.php b/src/Api/AssetTagApi.php index c43f6f97..3d63bec4 100644 --- a/src/Api/AssetTagApi.php +++ b/src/Api/AssetTagApi.php @@ -73,8 +73,8 @@ public function listPerPage(int $limit = 100, bool $withCount = false, array $qu return $this->pageFactory->createPage($data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::ASSET_TAG_URI, [$code], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::ASSET_TAG_URI, [$code], $data); } } diff --git a/src/Api/AssociationTypeApi.php b/src/Api/AssociationTypeApi.php index a881b13b..c40bb344 100644 --- a/src/Api/AssociationTypeApi.php +++ b/src/Api/AssociationTypeApi.php @@ -77,9 +77,9 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSOCIATION_TYPE_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::ASSOCIATION_TYPE_URI, [$code], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::ASSOCIATION_TYPE_URI, [$code], $data); } /** @@ -90,8 +90,8 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ASSOCIATION_TYPES_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface { - return $this->resourceClient->upsertAsyncStreamResourceList(static::ASSOCIATION_TYPES_URI, [], $resources, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncStreamResourceList(static::ASSOCIATION_TYPES_URI, [], $resources); } } diff --git a/src/Api/AttributeApi.php b/src/Api/AttributeApi.php index c0f71975..2b632487 100644 --- a/src/Api/AttributeApi.php +++ b/src/Api/AttributeApi.php @@ -80,9 +80,9 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ATTRIBUTE_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_URI, [$code], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_URI, [$code], $data); } /** @@ -93,8 +93,8 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTES_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface { - return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTES_URI, [], $resources, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTES_URI, [], $resources); } } diff --git a/src/Api/AttributeGroupApi.php b/src/Api/AttributeGroupApi.php index f60e13d3..c49e689d 100644 --- a/src/Api/AttributeGroupApi.php +++ b/src/Api/AttributeGroupApi.php @@ -80,9 +80,9 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ATTRIBUTE_GROUP_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_GROUP_URI, [$code], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_GROUP_URI, [$code], $data); } /** @@ -93,8 +93,8 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTE_GROUPS_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface { - return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTE_GROUPS_URI, [], $resources, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTE_GROUPS_URI, [], $resources); } } diff --git a/src/Api/AttributeOptionApi.php b/src/Api/AttributeOptionApi.php index 3b577bca..80c61e67 100644 --- a/src/Api/AttributeOptionApi.php +++ b/src/Api/AttributeOptionApi.php @@ -93,13 +93,13 @@ public function upsertList($attributeCode, $attributeOptions): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions); } - public function upsertAsyncList($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList($attributeCode, $attributeOptions): PromiseInterface { - return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions); } - public function upsertAsync($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync($attributeCode, $attributeOptionCode, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_OPTION_URI, [$attributeCode, $attributeOptionCode], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_OPTION_URI, [$attributeCode, $attributeOptionCode], $data); } } diff --git a/src/Api/AttributeOptionApiInterface.php b/src/Api/AttributeOptionApiInterface.php index af6136df..4c903217 100644 --- a/src/Api/AttributeOptionApiInterface.php +++ b/src/Api/AttributeOptionApiInterface.php @@ -99,7 +99,7 @@ public function upsert($attributeCode, $attributeOptionCode, array $data = []): * * @return Promise */ - public function upsertAsync($attributeCode, $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync($attributeCode, $attributeOptionCode, array $data = []): PromiseInterface; /** * Updates or creates several attribute options at once. @@ -123,5 +123,5 @@ public function upsertList($attributeCode, $attributeOptions): \Traversable; * * @return Promise */ - public function upsertAsyncList($attributeCode, $attributeOptions, callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsyncList($attributeCode, $attributeOptions): PromiseInterface; } diff --git a/src/Api/CategoryApi.php b/src/Api/CategoryApi.php index 3308a311..c8223e0c 100644 --- a/src/Api/CategoryApi.php +++ b/src/Api/CategoryApi.php @@ -80,9 +80,9 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::CATEGORY_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::CATEGORY_URI, [$code], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::CATEGORY_URI, [$code], $data); } /** @@ -93,8 +93,8 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::CATEGORIES_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface { - return $this->resourceClient->upsertAsyncStreamResourceList(static::CATEGORIES_URI, [], $resources, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncStreamResourceList(static::CATEGORIES_URI, [], $resources); } } diff --git a/src/Api/ChannelApi.php b/src/Api/ChannelApi.php index 4530dac4..5df077ef 100644 --- a/src/Api/ChannelApi.php +++ b/src/Api/ChannelApi.php @@ -80,9 +80,9 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::CHANNEL_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::CHANNEL_URI, [$code], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::CHANNEL_URI, [$code], $data); } /** @@ -93,8 +93,8 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::CHANNELS_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface { - return $this->resourceClient->upsertAsyncStreamResourceList(static::CHANNELS_URI, [], $resources, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncStreamResourceList(static::CHANNELS_URI, [], $resources); } } diff --git a/src/Api/FamilyApi.php b/src/Api/FamilyApi.php index 67a77d21..1b7c76f2 100644 --- a/src/Api/FamilyApi.php +++ b/src/Api/FamilyApi.php @@ -80,9 +80,9 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::FAMILY_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::FAMILY_URI, [$code], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::FAMILY_URI, [$code], $data); } /** @@ -93,8 +93,8 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::FAMILIES_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface { - return $this->resourceClient->upsertAsyncStreamResourceList(static::FAMILIES_URI, [], $resources, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncStreamResourceList(static::FAMILIES_URI, [], $resources); } } diff --git a/src/Api/FamilyVariantApi.php b/src/Api/FamilyVariantApi.php index 9cdba5d6..ab10e91a 100644 --- a/src/Api/FamilyVariantApi.php +++ b/src/Api/FamilyVariantApi.php @@ -122,8 +122,8 @@ public function upsertAsync($familyCode, $familyVariantCode, array $data = [], ? /** * {@inheritdoc} */ - public function upsertAsyncList($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList($familyCode, $familyVariants): PromiseInterface { - return $this->resourceClient->upsertAsyncStreamResourceList(static::FAMILY_VARIANTS_URI, [$familyCode], $familyVariants, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncStreamResourceList(static::FAMILY_VARIANTS_URI, [$familyCode], $familyVariants); } } diff --git a/src/Api/FamilyVariantApiInterface.php b/src/Api/FamilyVariantApiInterface.php index b6374a67..a5a09e59 100644 --- a/src/Api/FamilyVariantApiInterface.php +++ b/src/Api/FamilyVariantApiInterface.php @@ -75,7 +75,7 @@ public function upsert($familyCode, $familyVariantCode, array $data = []): int; * * @return Promise */ - public function upsertAsync($familyCode, $familyVariantCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync($familyCode, $familyVariantCode, array $data = []): PromiseInterface; /** * Available since Akeneo PIM 2.0. @@ -134,5 +134,5 @@ public function upsertList($familyCode, $familyVariants): \Traversable; * * @return Promise */ - public function upsertAsyncList($familyCode, $familyVariants, callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsyncList($familyCode, $familyVariants): PromiseInterface; } diff --git a/src/Api/Operation/UpsertableResourceInterface.php b/src/Api/Operation/UpsertableResourceInterface.php index cbba6c05..a806b001 100644 --- a/src/Api/Operation/UpsertableResourceInterface.php +++ b/src/Api/Operation/UpsertableResourceInterface.php @@ -37,5 +37,5 @@ public function upsert(string $code, array $data = []): int; * * @return Promise */ - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $code, array $data = []): PromiseInterface; } diff --git a/src/Api/Operation/UpsertableResourceListInterface.php b/src/Api/Operation/UpsertableResourceListInterface.php index 07c8d1ab..2f5591db 100644 --- a/src/Api/Operation/UpsertableResourceListInterface.php +++ b/src/Api/Operation/UpsertableResourceListInterface.php @@ -35,5 +35,5 @@ public function upsertList(array|StreamInterface $resources): \Traversable; * * @return Promise returns a Promise */ - public function upsertAsyncList(array|StreamInterface $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsyncList(array|StreamInterface $resources): PromiseInterface; } diff --git a/src/Api/ProductApi.php b/src/Api/ProductApi.php index edc61f0f..7f5c0cc9 100644 --- a/src/Api/ProductApi.php +++ b/src/Api/ProductApi.php @@ -82,9 +82,9 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::PRODUCT_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::PRODUCT_URI, [$code], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::PRODUCT_URI, [$code], $data); } /** @@ -103,8 +103,8 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::PRODUCTS_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface { - return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCTS_URI, [], $resources, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCTS_URI, [], $resources); } } diff --git a/src/Api/ProductModelApi.php b/src/Api/ProductModelApi.php index 022ad2d7..5190a9a4 100644 --- a/src/Api/ProductModelApi.php +++ b/src/Api/ProductModelApi.php @@ -127,8 +127,8 @@ public function upsertAsync(string $code, array $data = [], ?callable $onSuccess return $this->resourceClient->upsertAsyncResource(static::PRODUCT_MODEL_URI, [$code], $data); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface { - return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCT_MODELS_URI, [], $resources, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCT_MODELS_URI, [], $resources); } } diff --git a/src/Api/ProductUuidApi.php b/src/Api/ProductUuidApi.php index dd662d69..2fcf01e1 100644 --- a/src/Api/ProductUuidApi.php +++ b/src/Api/ProductUuidApi.php @@ -65,9 +65,9 @@ public function upsert(string $uuid, array $data = []): int return $this->resourceClient->upsertResource(static::PRODUCT_UUID_URI, [$uuid], $data); } - public function upsertAsync(string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $uuid, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::PRODUCT_UUID_URI, [$uuid], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::PRODUCT_UUID_URI, [$uuid], $data); } public function delete(string $uuid): int @@ -80,8 +80,8 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::PRODUCTS_UUID_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface { - return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCTS_UUID_URI, [], $resources, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCTS_UUID_URI, [], $resources); } } diff --git a/src/Api/ProductUuidApiInterface.php b/src/Api/ProductUuidApiInterface.php index f69d8f1d..195a86a4 100644 --- a/src/Api/ProductUuidApiInterface.php +++ b/src/Api/ProductUuidApiInterface.php @@ -20,7 +20,7 @@ public function create(string $uuid, array $data = []): int; public function upsert(string $uuid, array $data = []): int; - public function upsertAsync(string $uuid, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $uuid, array $data = []): PromiseInterface; public function delete(string $uuid): int; } diff --git a/src/Api/ReferenceEntityApi.php b/src/Api/ReferenceEntityApi.php index 8059feb1..2b55b6b8 100644 --- a/src/Api/ReferenceEntityApi.php +++ b/src/Api/ReferenceEntityApi.php @@ -61,8 +61,8 @@ public function upsert(string $referenceEntityCode, array $data = []): int return $this->resourceClient->upsertResource(static::REFERENCE_ENTITY_URI, [$referenceEntityCode], $data); } - public function upsertAsync(string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $referenceEntityCode, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_URI, [$referenceEntityCode], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_URI, [$referenceEntityCode], $data); } } diff --git a/src/Api/ReferenceEntityApiInterface.php b/src/Api/ReferenceEntityApiInterface.php index 0a71204a..37f0c386 100644 --- a/src/Api/ReferenceEntityApiInterface.php +++ b/src/Api/ReferenceEntityApiInterface.php @@ -62,5 +62,5 @@ public function upsert(string $referenceEntityCode, array $data = []): int; * * @return Promise */ - public function upsertAsync(string $referenceEntityCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, array $data = []): PromiseInterface; } diff --git a/src/Api/ReferenceEntityAttributeApi.php b/src/Api/ReferenceEntityAttributeApi.php index a11dc687..a1db0d95 100644 --- a/src/Api/ReferenceEntityAttributeApi.php +++ b/src/Api/ReferenceEntityAttributeApi.php @@ -49,8 +49,8 @@ public function upsert(string $referenceEntityCode, string $attributeCode, array /** * {@inheritdoc} */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_ATTRIBUTE_URI, [$referenceEntityCode, $attributeCode], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_ATTRIBUTE_URI, [$referenceEntityCode, $attributeCode], $data); } } diff --git a/src/Api/ReferenceEntityAttributeApiInterface.php b/src/Api/ReferenceEntityAttributeApiInterface.php index 72c0ee3b..27dfd288 100644 --- a/src/Api/ReferenceEntityAttributeApiInterface.php +++ b/src/Api/ReferenceEntityAttributeApiInterface.php @@ -63,5 +63,5 @@ public function upsert(string $referenceEntityCode, string $attributeCode, array * * @return Promise */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = []): PromiseInterface; } diff --git a/src/Api/ReferenceEntityAttributeOptionApiInterface.php b/src/Api/ReferenceEntityAttributeOptionApiInterface.php index addc1d2d..8eb8f84f 100644 --- a/src/Api/ReferenceEntityAttributeOptionApiInterface.php +++ b/src/Api/ReferenceEntityAttributeOptionApiInterface.php @@ -66,5 +66,5 @@ public function upsert(string $referenceEntityCode, string $attributeCode, strin * * @return Promise */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface; } diff --git a/src/Api/ReferenceEntityRecordApi.php b/src/Api/ReferenceEntityRecordApi.php index 8a58600c..91e42ab5 100644 --- a/src/Api/ReferenceEntityRecordApi.php +++ b/src/Api/ReferenceEntityRecordApi.php @@ -69,13 +69,13 @@ public function upsertList(string $referenceEntityCode, array $records): array return $this->resourceClient->upsertJsonResourceList(static::REFERENCE_ENTITY_RECORDS_URI, [$referenceEntityCode], $records); } - public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_RECORD_URI, [$referenceEntityCode, $recordCode], $data, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_RECORD_URI, [$referenceEntityCode, $recordCode], $data); } - public function upsertAsyncList(string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): PromiseInterface + public function upsertAsyncList(string $referenceEntityCode, array $records): PromiseInterface { - return $this->resourceClient->upsertAsyncJsonResourceList(static::REFERENCE_ENTITY_RECORDS_URI, [$referenceEntityCode], $records, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncJsonResourceList(static::REFERENCE_ENTITY_RECORDS_URI, [$referenceEntityCode], $records); } } diff --git a/src/Api/ReferenceEntityRecordApiInterface.php b/src/Api/ReferenceEntityRecordApiInterface.php index aca42740..07f20115 100644 --- a/src/Api/ReferenceEntityRecordApiInterface.php +++ b/src/Api/ReferenceEntityRecordApiInterface.php @@ -66,7 +66,7 @@ public function upsert(string $referenceEntityCode, string $recordCode, array $d * * @return Promise */ - public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = [], callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = []): PromiseInterface; /** * Updates or creates several reference entity records. @@ -90,5 +90,5 @@ public function upsertList(string $referenceEntityCode, array $records): array; * * @return Promise */ - public function upsertAsyncList(string $referenceEntityCode, array $records, callable $onSuccess = null, callable $onFail = null): PromiseInterface; + public function upsertAsyncList(string $referenceEntityCode, array $records): PromiseInterface; } diff --git a/src/Client/AuthenticatedHttpClient.php b/src/Client/AuthenticatedHttpClient.php index 139d3d08..086db3ba 100644 --- a/src/Client/AuthenticatedHttpClient.php +++ b/src/Client/AuthenticatedHttpClient.php @@ -82,9 +82,7 @@ public function sendAsync( string $httpMethod, $uri, array $headers = [], - $body = null, - callable $onSuccess = null, - callable $onFail = null): PromiseInterface + $body = null): PromiseInterface { if (null === $this->authentication->getAccessToken()) { $tokens = $this->authenticationApi->authenticateByPassword( @@ -101,7 +99,7 @@ public function sendAsync( try { $headers['Authorization'] = sprintf('Bearer %s', $this->authentication->getAccessToken()); - return $this->basicHttpClient->sendAsync($httpMethod, $uri, $headers, $body, $onSuccess, $onFail); + return $this->basicHttpClient->sendAsync($httpMethod, $uri, $headers, $body); } catch (UnauthorizedHttpException $e) { $tokens = $this->renewTokens($e); @@ -110,7 +108,7 @@ public function sendAsync( ->setRefreshToken($tokens['refresh_token']); $headers['Authorization'] = sprintf('Bearer %s', $this->authentication->getAccessToken()); - return $this->basicHttpClient->sendAsync($httpMethod, $uri, $headers, $body, $onSuccess, $onFail); + return $this->basicHttpClient->sendAsync($httpMethod, $uri, $headers, $body); } } } diff --git a/src/Client/CachedResourceClient.php b/src/Client/CachedResourceClient.php index 366a409b..6fa6b0bb 100644 --- a/src/Client/CachedResourceClient.php +++ b/src/Client/CachedResourceClient.php @@ -77,11 +77,9 @@ public function upsertResource(string $uri, array $uriParameters = [], array $bo public function upsertAsyncResource( string $uri, array $uriParameters = [], - array $body = [], - callable $onSuccess = null, - callable $onFail = null): PromiseInterface + array $body = []): PromiseInterface { - return $this->resourceClient->upsertAsyncResource($uri, $uriParameters, $body, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncResource($uri, $uriParameters, $body); } /** @@ -95,11 +93,9 @@ public function upsertStreamResourceList(string $uri, array $uriParameters = [], public function upsertAsyncStreamResourceList( string $uri, array $uriParameters = [], - $resources = [], - callable $onSuccess = null, - callable $onFail = null): PromiseInterface + $resources = []): PromiseInterface { - return $this->resourceClient->upsertAsyncStreamResourceList($uri, $uriParameters, $resources, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncStreamResourceList($uri, $uriParameters, $resources); } /** @@ -113,11 +109,9 @@ public function upsertJsonResourceList(string $uri, array $uriParameters = [], a public function upsertAsyncJsonResourceList( string $uri, array $uriParameters = [], - array $resources = [], - callable $onSuccess = null, - callable $onFail = null): PromiseInterface + array $resources = []): PromiseInterface { - return $this->resourceClient->upsertAsyncJsonResourceList($uri, $uriParameters, $resources, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncJsonResourceList($uri, $uriParameters, $resources); } /** @@ -155,10 +149,8 @@ public function upsertAndReturnResource(string $uri, array $uriParameters = [], public function upsertAsyncAndReturnPromise( string $uri, array $uriParameters = [], - array $body = [], - callable $onSuccess = null, - callable $onFail = null): PromiseInterface + array $body = []): PromiseInterface { - return $this->resourceClient->upsertAsyncAndReturnPromise($uri, $uriParameters, $body, $onSuccess, $onFail); + return $this->resourceClient->upsertAsyncAndReturnPromise($uri, $uriParameters, $body); } } diff --git a/src/Client/HttpClient.php b/src/Client/HttpClient.php index 9bc4f438..98ec35f2 100644 --- a/src/Client/HttpClient.php +++ b/src/Client/HttpClient.php @@ -81,9 +81,7 @@ public function sendAsync( string $httpMethod, $uri, array $headers = [], - $body = null, - callable $onSuccess = null, - callable $onFail = null): PromiseInterface + $body = null): PromiseInterface { $request = $this->prepareRequest($httpMethod, $uri, $headers, $body); diff --git a/src/Client/HttpClientInterface.php b/src/Client/HttpClientInterface.php index 1ba9408e..07e8147b 100644 --- a/src/Client/HttpClientInterface.php +++ b/src/Client/HttpClientInterface.php @@ -43,13 +43,11 @@ public function sendRequest(string $httpMethod, $uri, array $headers = [], $body * * @throws HttpException If the request failed. * - * @return Promise + * @return PromiseInterface */ public function sendAsync( string $httpMethod, $uri, array $headers = [], - $body = null, - callable $onSuccess = null, - callable $onFail = null): PromiseInterface; + $body = null): PromiseInterface; } diff --git a/src/Client/ResourceClient.php b/src/Client/ResourceClient.php index 79e58fd9..d3896025 100644 --- a/src/Client/ResourceClient.php +++ b/src/Client/ResourceClient.php @@ -128,11 +128,9 @@ public function upsertResource(string $uri, array $uriParameters = [], array $bo public function upsertAsyncResource( string $uri, array $uriParameters = [], - array $body = [], - callable $onSuccess = null, - callable $onFail = null): PromiseInterface + array $body = []): PromiseInterface { - return $this->sendAsyncUpsertRequest($uri, $uriParameters, $body, $onSuccess, $onFail); + return $this->sendAsyncUpsertRequest($uri, $uriParameters, $body); } /** @@ -148,11 +146,9 @@ public function upsertAndReturnResource(string $uri, array $uriParameters = [], public function upsertAsyncAndReturnPromise( string $uri, array $uriParameters = [], - array $body = [], - callable $onSuccess = null, - callable $onFail = null): PromiseInterface + array $body = []): PromiseInterface { - return $this->sendAsyncUpsertRequest($uri, $uriParameters, $body, $onSuccess, $onFail); + return $this->sendAsyncUpsertRequest($uri, $uriParameters, $body); } public function prepareResourceListRequest(array|StreamInterface $resources): StreamInterface|string @@ -199,9 +195,7 @@ public function upsertStreamResourceList(string $uri, array $uriParameters = [], public function upsertAsyncStreamResourceList( string $uri, array $uriParameters = [], - $resources = [], - callable $onSuccess = null, - callable $onFail = null): PromiseInterface + $resources = []): PromiseInterface { $body = $this->prepareResourceListRequest($resources); $uri = $this->uriGenerator->generate($uri, $uriParameters); @@ -209,9 +203,7 @@ public function upsertAsyncStreamResourceList( 'PATCH', $uri, ['Content-Type' => 'application/vnd.akeneo.collection+json'], - $body, - $onSuccess, - $onFail + $body ); } @@ -239,18 +231,14 @@ public function upsertJsonResourceList(string $uri, array $uriParameters = [], a public function upsertAsyncJsonResourceList( string $uri, array $uriParameters = [], - array $resources = [], - callable $onSuccess = null, - callable $onFail = null): PromiseInterface + array $resources = []): PromiseInterface { $uri = $this->uriGenerator->generate($uri, $uriParameters); return $this->httpClient->sendAsync( 'PATCH', $uri, ['Content-Type' => 'application/json'], - json_encode($resources), - $onSuccess, - $onFail + json_encode($resources) ); } @@ -307,9 +295,7 @@ private function sendUpsertRequest(string $uri, array $uriParameters = [], array private function sendAsyncUpsertRequest( string $uri, array $uriParameters = [], - array $body = [], - callable $onSuccess = null, - callable $onFail = null): PromiseInterface + array $body = []): PromiseInterface { unset($body['_links']); @@ -319,9 +305,7 @@ private function sendAsyncUpsertRequest( 'PATCH', $uri, ['Content-Type' => 'application/json'], - json_encode($body), - $onSuccess, - $onFail + json_encode($body) ); } } diff --git a/src/Client/ResourceClientInterface.php b/src/Client/ResourceClientInterface.php index 93cb746f..130db117 100644 --- a/src/Client/ResourceClientInterface.php +++ b/src/Client/ResourceClientInterface.php @@ -126,9 +126,7 @@ public function upsertResource(string $uri, array $uriParameters = [], array $bo public function upsertAsyncResource( string $uri, array $uriParameters = [], - array $body = [], - callable $onSuccess = null, - callable $onFail = null): PromiseInterface; + array $body = []): PromiseInterface; /** * Creates and returns a resource if it does not exist yet, otherwise updates partially and returns the resource. @@ -157,9 +155,7 @@ public function upsertAndReturnResource(string $uri, array $uriParameters = [], public function upsertAsyncAndReturnPromise( string $uri, array $uriParameters = [], - array $body = [], - callable $onSuccess = null, - callable $onFail = null): PromiseInterface; + array $body = []): PromiseInterface; /** * Updates or creates several resources using a stream for the request and the response. @@ -194,9 +190,7 @@ public function upsertStreamResourceList(string $uri, array $uriParameters = [], public function upsertAsyncStreamResourceList( string $uri, array $uriParameters = [], - $resources = [], - callable $onSuccess = null, - callable $onFail = null): PromiseInterface; + $resources = []): PromiseInterface; /** * Updates or creates several resources using a single JSON string for the request and the response. @@ -229,9 +223,7 @@ public function upsertJsonResourceList(string $uri, array $uriParameters = [], a public function upsertAsyncJsonResourceList( string $uri, array $uriParameters = [], - array $resources = [], - callable $onSuccess = null, - callable $onFail = null): PromiseInterface; + array $resources = []): PromiseInterface; /** * Deletes a resource. From 03d618eee60a19cf432894a8cf8a81adbdfdcc9f Mon Sep 17 00:00:00 2001 From: gwendalaubert Date: Mon, 26 Jun 2023 17:49:14 +0200 Subject: [PATCH 08/10] DX-104 : Remainder of last rollback --- src/Api/AssetManager/AssetAttributeOptionApi.php | 2 +- src/Api/FamilyVariantApi.php | 2 +- src/Api/ProductModelApi.php | 2 +- src/Api/ReferenceEntityAttributeOptionApi.php | 2 +- src/Client/HttpClient.php | 2 +- src/Client/HttpClientInterface.php | 2 -- src/Client/ResourceClientInterface.php | 14 +++----------- 7 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/Api/AssetManager/AssetAttributeOptionApi.php b/src/Api/AssetManager/AssetAttributeOptionApi.php index 8ef6a16d..c915e6f1 100644 --- a/src/Api/AssetManager/AssetAttributeOptionApi.php +++ b/src/Api/AssetManager/AssetAttributeOptionApi.php @@ -51,7 +51,7 @@ public function upsert(string $assetFamilyCode, string $attributeCode, string $a ); } - public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): PromiseInterface + public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface { return $this->resourceClient->upsertAsyncResource( static::ASSET_ATTRIBUTE_OPTION_URI, diff --git a/src/Api/FamilyVariantApi.php b/src/Api/FamilyVariantApi.php index ab10e91a..0c5f64b2 100644 --- a/src/Api/FamilyVariantApi.php +++ b/src/Api/FamilyVariantApi.php @@ -106,7 +106,7 @@ public function upsertList($familyCode, $familyVariants): \Traversable /** * {@inheritdoc} */ - public function upsertAsync($familyCode, $familyVariantCode, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): PromiseInterface + public function upsertAsync($familyCode, $familyVariantCode, array $data = []): PromiseInterface { if (array_key_exists('family', $data)) { throw new InvalidArgumentException('The parameter "family" must not be defined in the data parameter'); diff --git a/src/Api/ProductModelApi.php b/src/Api/ProductModelApi.php index 5190a9a4..c2ee8982 100644 --- a/src/Api/ProductModelApi.php +++ b/src/Api/ProductModelApi.php @@ -116,7 +116,7 @@ public function delete(string $code): int return $this->resourceClient->deleteResource(static::PRODUCT_MODEL_URI, [$code]); } - public function upsertAsync(string $code, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface { if (array_key_exists('code', $data)) { throw new InvalidArgumentException('The parameter "code" must not be defined in the data parameter'); diff --git a/src/Api/ReferenceEntityAttributeOptionApi.php b/src/Api/ReferenceEntityAttributeOptionApi.php index c3708b26..c36bc94b 100644 --- a/src/Api/ReferenceEntityAttributeOptionApi.php +++ b/src/Api/ReferenceEntityAttributeOptionApi.php @@ -59,7 +59,7 @@ public function upsert(string $referenceEntityCode, string $attributeCode, strin /** * {@inheritdoc} */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = [], ?callable $onSuccess = null, ?callable $onFail = null): PromiseInterface + public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface { return $this->resourceClient->upsertAsyncResource( static::REFERENCE_ENTITY_ATTRIBUTE_OPTION_URI, diff --git a/src/Client/HttpClient.php b/src/Client/HttpClient.php index 98ec35f2..1e133887 100644 --- a/src/Client/HttpClient.php +++ b/src/Client/HttpClient.php @@ -85,6 +85,6 @@ public function sendAsync( { $request = $this->prepareRequest($httpMethod, $uri, $headers, $body); - return $this->httpClient->sendAsyncRequest($request)->then($onSuccess, $onFail); + return $this->httpClient->sendAsyncRequest($request); } } diff --git a/src/Client/HttpClientInterface.php b/src/Client/HttpClientInterface.php index 07e8147b..55c0a1d8 100644 --- a/src/Client/HttpClientInterface.php +++ b/src/Client/HttpClientInterface.php @@ -38,8 +38,6 @@ public function sendRequest(string $httpMethod, $uri, array $headers = [], $body * @param string|UriInterface $uri URI of the request * @param array $headers headers of the request * @param string|StreamInterface|null $body body of the request - * @param ?callable $onSuccess Callback in case of success - * @param ?callable $onFail Callback in case of fail * * @throws HttpException If the request failed. * diff --git a/src/Client/ResourceClientInterface.php b/src/Client/ResourceClientInterface.php index 130db117..e23ff8a7 100644 --- a/src/Client/ResourceClientInterface.php +++ b/src/Client/ResourceClientInterface.php @@ -116,12 +116,10 @@ public function upsertResource(string $uri, array $uriParameters = [], array $bo * @param string $uri URI of the resource * @param array $uriParameters URI parameters of the resource * @param array $body Body of the request - * @param ?callable $onSuccess Callback in case of success - * @param ?callable $onFail Callback in case of fail * * @throws HttpException If the request failed. * - * @return Promise + * @return PromiseInterface */ public function upsertAsyncResource( string $uri, @@ -146,8 +144,6 @@ public function upsertAndReturnResource(string $uri, array $uriParameters = [], * @param string $uri URI of the resource * @param array $uriParameters URI parameters of the resource * @param array $body Body of the request - * @param ?callable $onSuccess Callback in case of success - * @param ?callable $onFail Callback in case of fail * * @throws HttpException If the request failed. * @@ -179,13 +175,11 @@ public function upsertStreamResourceList(string $uri, array $uriParameters = [], * @param array $uriParameters URI parameters of the resource * @param array|StreamInterface $resources array of resources to create or update. * You can pass your own StreamInterface implementation as well. - * @param ?callable $onSuccess Callback in case of success - * @param ?callable $onFail Callback in case of fail * * @throws HttpException If the request failed. * @throws InvalidArgumentException If the resources or any part thereof are invalid. * - * @return Promise returns a Promise + * @return PromiseInterface returns a Promise */ public function upsertAsyncStreamResourceList( string $uri, @@ -212,13 +206,11 @@ public function upsertJsonResourceList(string $uri, array $uriParameters = [], a * @param string $uri URI of the resource * @param array $uriParameters URI parameters of the resource * @param array $resources array of resources to create or update. - * @param ?callable $onSuccess Callback in case of success - * @param ?callable $onFail Callback in case of fail * * @throws HttpException If the request failed. * @throws InvalidArgumentException If the resources or any part thereof are invalid. * - * @return Promise + * @return PromiseInterface */ public function upsertAsyncJsonResourceList( string $uri, From 6852f899cd9cf156490444a8dac2bdc218e3ca5f Mon Sep 17 00:00:00 2001 From: gwendalaubert Date: Tue, 27 Jun 2023 14:57:18 +0200 Subject: [PATCH 09/10] DX-104 : Adding tests + refactor --- phpunit.xml.dist | 3 +- src/AkeneoPimClientBuilder.php | 2 +- src/Api/AppCatalog/AppCatalogApi.php | 3 +- src/Api/AppCatalog/AppCatalogApiInterface.php | 3 +- src/Api/AssetApi.php | 5 +- src/Api/AssetCategoryApi.php | 5 +- src/Api/AssetManager/AssetApi.php | 5 +- src/Api/AssetManager/AssetApiInterface.php | 5 +- src/Api/AssetManager/AssetAttributeApi.php | 3 +- .../AssetAttributeApiInterface.php | 3 +- .../AssetManager/AssetAttributeOptionApi.php | 9 +- .../AssetAttributeOptionApiInterface.php | 8 +- src/Api/AssetManager/AssetFamilyApi.php | 3 +- .../AssetManager/AssetFamilyApiInterface.php | 3 +- src/Api/AssetTagApi.php | 3 +- src/Api/AssociationTypeApi.php | 5 +- src/Api/AttributeApi.php | 5 +- src/Api/AttributeGroupApi.php | 5 +- src/Api/AttributeOptionApi.php | 5 +- src/Api/AttributeOptionApiInterface.php | 5 +- src/Api/CategoryApi.php | 5 +- src/Api/ChannelApi.php | 5 +- src/Api/FamilyApi.php | 5 +- src/Api/FamilyVariantApi.php | 5 +- src/Api/FamilyVariantApiInterface.php | 5 +- .../Operation/UpsertableResourceInterface.php | 3 +- .../UpsertableResourceListInterface.php | 5 +- src/Api/ProductApi.php | 5 +- src/Api/ProductModelApi.php | 5 +- src/Api/ProductUuidApi.php | 5 +- src/Api/ProductUuidApiInterface.php | 3 +- src/Api/ReferenceEntityApi.php | 3 +- src/Api/ReferenceEntityApiInterface.php | 3 +- src/Api/ReferenceEntityAttributeApi.php | 9 +- .../ReferenceEntityAttributeApiInterface.php | 3 +- src/Api/ReferenceEntityAttributeOptionApi.php | 9 +- ...renceEntityAttributeOptionApiInterface.php | 8 +- src/Api/ReferenceEntityRecordApi.php | 5 +- src/Api/ReferenceEntityRecordApiInterface.php | 5 +- src/Client/AuthenticatedHttpClient.php | 5 +- src/Client/CachedResourceClient.php | 17 ++-- src/Client/ClientInterface.php | 3 +- src/Client/HttpClient.php | 5 +- src/Client/HttpClientInterface.php | 6 +- src/Client/ResourceClient.php | 23 ++--- src/Client/ResourceClientInterface.php | 19 ++-- .../UpsertAppCatalogIntegration.php | 29 +++++++ tests/Api/Asset/UpsertAssetIntegration.php | 40 +++++++++ .../Api/Asset/UpsertListAssetIntegration.php | 87 +++++++++++++++++++ .../UpsertAssetFamilyAttributeIntegration.php | 37 ++++++++ ...tAssetFamilyAttributeOptionIntegration.php | 36 ++++++++ .../UpsertAssetFamilyIntegration.php | 27 ++++++ .../DownloadAssetReferenceFileIntegration.php | 9 +- .../UploadAssetReferenceFileIntegration.php | 12 +-- ...wnloadAssetVariationFileApiIntegration.php | 11 ++- ...UploadAssetVariationFileApiIntegration.php | 11 ++- .../UpsertListProductUuidIntegration.php | 73 ++++++++++++++++ .../UpsertProductUuidIntegration.php | 37 ++++++++ .../UpsertReferenceEntityIntegration.php | 28 ++++++ ...rtListReferenceEntityRecordIntegration.php | 72 +++++++++++++++ ...UpsertReferenceEntityRecordIntegration.php | 33 +++++++ tests/Api/UpsertListProductTest.php | 68 +++++++++++++++ tests/Api/UpsertProductTest.php | 32 +++++++ tests/Client/CachedResourceClientTest.php | 4 +- 64 files changed, 787 insertions(+), 121 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 027b1ff6..c8fd9ed2 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,7 +8,8 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="false"> + stopOnFailure="false" + cacheResult ="false"> tests/ diff --git a/src/AkeneoPimClientBuilder.php b/src/AkeneoPimClientBuilder.php index b302a919..375af807 100644 --- a/src/AkeneoPimClientBuilder.php +++ b/src/AkeneoPimClientBuilder.php @@ -44,9 +44,9 @@ use Akeneo\Pim\ApiClient\Cache\LRUCache; use Akeneo\Pim\ApiClient\Client\AuthenticatedHttpClient; use Akeneo\Pim\ApiClient\Client\CachedResourceClient; +use Akeneo\Pim\ApiClient\Client\ClientInterface; use Akeneo\Pim\ApiClient\Client\HttpClient; use Akeneo\Pim\ApiClient\Client\Options; -use Akeneo\Pim\ApiClient\Client\ClientInterface; use Akeneo\Pim\ApiClient\Client\ResourceClient; use Akeneo\Pim\ApiClient\FileSystem\FileSystemInterface; use Akeneo\Pim\ApiClient\FileSystem\LocalFileSystem; diff --git a/src/Api/AppCatalog/AppCatalogApi.php b/src/Api/AppCatalog/AppCatalogApi.php index 6ec9b3bb..c8f1681a 100644 --- a/src/Api/AppCatalog/AppCatalogApi.php +++ b/src/Api/AppCatalog/AppCatalogApi.php @@ -11,6 +11,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -62,7 +63,7 @@ public function delete(string $code): int return $this->resourceClient->deleteResource(static::APP_CATALOG_URI, [$code]); } - public function upsertAsync(string $code, array $data = []): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncAndReturnPromise(static::APP_CATALOG_URI, [$code], $data); } diff --git a/src/Api/AppCatalog/AppCatalogApiInterface.php b/src/Api/AppCatalog/AppCatalogApiInterface.php index d07d9102..8a294a86 100644 --- a/src/Api/AppCatalog/AppCatalogApiInterface.php +++ b/src/Api/AppCatalog/AppCatalogApiInterface.php @@ -8,6 +8,7 @@ use Akeneo\Pim\ApiClient\Api\Operation\GettableResourceInterface; use Akeneo\Pim\ApiClient\Api\Operation\ListableResourceInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -21,5 +22,5 @@ interface AppCatalogApiInterface extends public function create(array $data): array; public function upsert(string $code, array $data = []): array; - public function upsertAsync(string $code, array $data = []): PromiseInterface; + public function upsertAsync(string $code, array $data = []): PromiseInterface|Promise; } diff --git a/src/Api/AssetApi.php b/src/Api/AssetApi.php index fec4bb73..f33215b7 100644 --- a/src/Api/AssetApi.php +++ b/src/Api/AssetApi.php @@ -11,6 +11,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -91,7 +92,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSET_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = []): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_URI, [$code], $data); } @@ -104,7 +105,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ASSETS_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncStreamResourceList(self::ASSETS_URI, [], $resources); } diff --git a/src/Api/AssetCategoryApi.php b/src/Api/AssetCategoryApi.php index 1bab01a2..4d874e8f 100644 --- a/src/Api/AssetCategoryApi.php +++ b/src/Api/AssetCategoryApi.php @@ -11,6 +11,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -76,7 +77,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSET_CATEGORY_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = []): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_CATEGORY_URI, [$code], $data); } @@ -103,7 +104,7 @@ public function create(string $code, array $data = []): int return $this->resourceClient->createResource(static::ASSET_CATEGORIES_URI, [], $data); } - public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ASSET_CATEGORIES_URI, [], $resources); } diff --git a/src/Api/AssetManager/AssetApi.php b/src/Api/AssetManager/AssetApi.php index 8014881c..0df70ea2 100644 --- a/src/Api/AssetManager/AssetApi.php +++ b/src/Api/AssetManager/AssetApi.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; class AssetApi implements AssetApiInterface { @@ -75,7 +76,7 @@ public function delete(string $assetFamilyCode, string $assetCode): int /** * {@inheritdoc} */ - public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = []): PromiseInterface + public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_URI, [$assetFamilyCode, $assetCode], $data); } @@ -83,7 +84,7 @@ public function upsertAsync(string $assetFamilyCode, string $assetCode, array $d /** * {@inheritdoc} */ - public function upsertAsyncList(string $assetFamilyCode, array $assets): PromiseInterface + public function upsertAsyncList(string $assetFamilyCode, array $assets): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncJsonResourceList(static::ASSETS_URI, [$assetFamilyCode], $assets); } diff --git a/src/Api/AssetManager/AssetApiInterface.php b/src/Api/AssetManager/AssetApiInterface.php index fde256dd..c3349d2e 100644 --- a/src/Api/AssetManager/AssetApiInterface.php +++ b/src/Api/AssetManager/AssetApiInterface.php @@ -7,6 +7,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; interface AssetApiInterface { @@ -64,7 +65,7 @@ public function upsertList(string $assetFamilyCode, array $assets): array; * * @return Promise */ - public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = []): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, string $assetCode, array $data = []): PromiseInterface|Promise; /** * Updates or creates several assets. @@ -76,7 +77,7 @@ public function upsertAsync(string $assetFamilyCode, string $assetCode, array $d * * @return Promise */ - public function upsertAsyncList(string $assetFamilyCode, array $assets): PromiseInterface; + public function upsertAsyncList(string $assetFamilyCode, array $assets): PromiseInterface|Promise; /** * Deletes an asset. diff --git a/src/Api/AssetManager/AssetAttributeApi.php b/src/Api/AssetManager/AssetAttributeApi.php index 3965319b..2d16e1c6 100644 --- a/src/Api/AssetManager/AssetAttributeApi.php +++ b/src/Api/AssetManager/AssetAttributeApi.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; class AssetAttributeApi implements AssetAttributeApiInterface { @@ -44,7 +45,7 @@ public function upsert(string $assetFamilyCode, string $attributeCode, array $da /** * {@inheritdoc} */ - public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = []): PromiseInterface + public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_ATTRIBUTE_URI, [$assetFamilyCode, $attributeCode], $data); } diff --git a/src/Api/AssetManager/AssetAttributeApiInterface.php b/src/Api/AssetManager/AssetAttributeApiInterface.php index 9e54b8c7..9980f533 100644 --- a/src/Api/AssetManager/AssetAttributeApiInterface.php +++ b/src/Api/AssetManager/AssetAttributeApiInterface.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; interface AssetAttributeApiInterface { @@ -40,5 +41,5 @@ public function upsert(string $assetFamilyCode, string $attributeCode, array $da * * @return Promise */ - public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = []): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, string $attributeCode, array $data = []): PromiseInterface|Promise; } diff --git a/src/Api/AssetManager/AssetAttributeOptionApi.php b/src/Api/AssetManager/AssetAttributeOptionApi.php index c915e6f1..059d26d7 100644 --- a/src/Api/AssetManager/AssetAttributeOptionApi.php +++ b/src/Api/AssetManager/AssetAttributeOptionApi.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; class AssetAttributeOptionApi implements AssetAttributeOptionApiInterface { @@ -51,8 +52,12 @@ public function upsert(string $assetFamilyCode, string $attributeCode, string $a ); } - public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface - { + public function upsertAsync( + string $assetFamilyCode, + string $attributeCode, + string $attributeOptionCode, + array $data = [] + ): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource( static::ASSET_ATTRIBUTE_OPTION_URI, [$assetFamilyCode, $attributeCode, $attributeOptionCode], diff --git a/src/Api/AssetManager/AssetAttributeOptionApiInterface.php b/src/Api/AssetManager/AssetAttributeOptionApiInterface.php index 37fcc214..96ac2503 100644 --- a/src/Api/AssetManager/AssetAttributeOptionApiInterface.php +++ b/src/Api/AssetManager/AssetAttributeOptionApiInterface.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; interface AssetAttributeOptionApiInterface { @@ -40,5 +41,10 @@ public function upsert(string $assetFamilyCode, string $attributeCode, string $a * * @return Promise */ - public function upsertAsync(string $assetFamilyCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface; + public function upsertAsync( + string $assetFamilyCode, + string $attributeCode, + string $attributeOptionCode, + array $data = [] + ): PromiseInterface|Promise; } diff --git a/src/Api/AssetManager/AssetFamilyApi.php b/src/Api/AssetManager/AssetFamilyApi.php index 0a5805a6..ff9c602a 100644 --- a/src/Api/AssetManager/AssetFamilyApi.php +++ b/src/Api/AssetManager/AssetFamilyApi.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; class AssetFamilyApi implements AssetFamilyApiInterface { @@ -59,7 +60,7 @@ public function upsert(string $code, array $data = []): int /** * {@inheritdoc} */ - public function upsertAsync(string $code, array $data = []): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_FAMILY_URI, [$code], $data); } diff --git a/src/Api/AssetManager/AssetFamilyApiInterface.php b/src/Api/AssetManager/AssetFamilyApiInterface.php index fe9d9dd5..4db76071 100644 --- a/src/Api/AssetManager/AssetFamilyApiInterface.php +++ b/src/Api/AssetManager/AssetFamilyApiInterface.php @@ -7,6 +7,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; interface AssetFamilyApiInterface { @@ -41,5 +42,5 @@ public function upsert(string $assetFamilyCode, array $data = []): int; * * @return Promise */ - public function upsertAsync(string $assetFamilyCode, array $data = []): PromiseInterface; + public function upsertAsync(string $assetFamilyCode, array $data = []): PromiseInterface|Promise; } diff --git a/src/Api/AssetTagApi.php b/src/Api/AssetTagApi.php index 3d63bec4..04484c17 100644 --- a/src/Api/AssetTagApi.php +++ b/src/Api/AssetTagApi.php @@ -10,6 +10,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * API implementation to manage asset tags. @@ -73,7 +74,7 @@ public function listPerPage(int $limit = 100, bool $withCount = false, array $qu return $this->pageFactory->createPage($data); } - public function upsertAsync(string $code, array $data = []): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::ASSET_TAG_URI, [$code], $data); } diff --git a/src/Api/AssociationTypeApi.php b/src/Api/AssociationTypeApi.php index c40bb344..7ea8fa4a 100644 --- a/src/Api/AssociationTypeApi.php +++ b/src/Api/AssociationTypeApi.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -77,7 +78,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ASSOCIATION_TYPE_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = []): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::ASSOCIATION_TYPE_URI, [$code], $data); } @@ -90,7 +91,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ASSOCIATION_TYPES_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ASSOCIATION_TYPES_URI, [], $resources); } diff --git a/src/Api/AttributeApi.php b/src/Api/AttributeApi.php index 2b632487..7ce663e2 100644 --- a/src/Api/AttributeApi.php +++ b/src/Api/AttributeApi.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +81,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ATTRIBUTE_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = []): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_URI, [$code], $data); } @@ -93,7 +94,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTES_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTES_URI, [], $resources); } diff --git a/src/Api/AttributeGroupApi.php b/src/Api/AttributeGroupApi.php index c49e689d..bb4d7638 100644 --- a/src/Api/AttributeGroupApi.php +++ b/src/Api/AttributeGroupApi.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +81,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::ATTRIBUTE_GROUP_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = []): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_GROUP_URI, [$code], $data); } @@ -93,7 +94,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTE_GROUPS_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTE_GROUPS_URI, [], $resources); } diff --git a/src/Api/AttributeOptionApi.php b/src/Api/AttributeOptionApi.php index 80c61e67..a964d0d3 100644 --- a/src/Api/AttributeOptionApi.php +++ b/src/Api/AttributeOptionApi.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * API implementation to manage the attribute options. @@ -93,12 +94,12 @@ public function upsertList($attributeCode, $attributeOptions): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions); } - public function upsertAsyncList($attributeCode, $attributeOptions): PromiseInterface + public function upsertAsyncList($attributeCode, $attributeOptions): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions); } - public function upsertAsync($attributeCode, $attributeOptionCode, array $data = []): PromiseInterface + public function upsertAsync($attributeCode, $attributeOptionCode, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_OPTION_URI, [$attributeCode, $attributeOptionCode], $data); } diff --git a/src/Api/AttributeOptionApiInterface.php b/src/Api/AttributeOptionApiInterface.php index 4c903217..5f17f68f 100644 --- a/src/Api/AttributeOptionApiInterface.php +++ b/src/Api/AttributeOptionApiInterface.php @@ -7,6 +7,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -99,7 +100,7 @@ public function upsert($attributeCode, $attributeOptionCode, array $data = []): * * @return Promise */ - public function upsertAsync($attributeCode, $attributeOptionCode, array $data = []): PromiseInterface; + public function upsertAsync($attributeCode, $attributeOptionCode, array $data = []): PromiseInterface|Promise; /** * Updates or creates several attribute options at once. @@ -123,5 +124,5 @@ public function upsertList($attributeCode, $attributeOptions): \Traversable; * * @return Promise */ - public function upsertAsyncList($attributeCode, $attributeOptions): PromiseInterface; + public function upsertAsyncList($attributeCode, $attributeOptions): PromiseInterface|Promise; } diff --git a/src/Api/CategoryApi.php b/src/Api/CategoryApi.php index c8223e0c..26bfec16 100644 --- a/src/Api/CategoryApi.php +++ b/src/Api/CategoryApi.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +81,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::CATEGORY_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = []): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::CATEGORY_URI, [$code], $data); } @@ -93,7 +94,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::CATEGORIES_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::CATEGORIES_URI, [], $resources); } diff --git a/src/Api/ChannelApi.php b/src/Api/ChannelApi.php index 5df077ef..b099b762 100644 --- a/src/Api/ChannelApi.php +++ b/src/Api/ChannelApi.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +81,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::CHANNEL_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = []): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::CHANNEL_URI, [$code], $data); } @@ -93,7 +94,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::CHANNELS_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::CHANNELS_URI, [], $resources); } diff --git a/src/Api/FamilyApi.php b/src/Api/FamilyApi.php index 1b7c76f2..255497c0 100644 --- a/src/Api/FamilyApi.php +++ b/src/Api/FamilyApi.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -80,7 +81,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::FAMILY_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = []): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::FAMILY_URI, [$code], $data); } @@ -93,7 +94,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::FAMILIES_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::FAMILIES_URI, [], $resources); } diff --git a/src/Api/FamilyVariantApi.php b/src/Api/FamilyVariantApi.php index 0c5f64b2..84d238ca 100644 --- a/src/Api/FamilyVariantApi.php +++ b/src/Api/FamilyVariantApi.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * Api implementation to manages Family Variants @@ -106,7 +107,7 @@ public function upsertList($familyCode, $familyVariants): \Traversable /** * {@inheritdoc} */ - public function upsertAsync($familyCode, $familyVariantCode, array $data = []): PromiseInterface + public function upsertAsync($familyCode, $familyVariantCode, array $data = []): PromiseInterface|Promise { if (array_key_exists('family', $data)) { throw new InvalidArgumentException('The parameter "family" must not be defined in the data parameter'); @@ -122,7 +123,7 @@ public function upsertAsync($familyCode, $familyVariantCode, array $data = []): /** * {@inheritdoc} */ - public function upsertAsyncList($familyCode, $familyVariants): PromiseInterface + public function upsertAsyncList($familyCode, $familyVariants): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::FAMILY_VARIANTS_URI, [$familyCode], $familyVariants); } diff --git a/src/Api/FamilyVariantApiInterface.php b/src/Api/FamilyVariantApiInterface.php index a5a09e59..723b3058 100644 --- a/src/Api/FamilyVariantApiInterface.php +++ b/src/Api/FamilyVariantApiInterface.php @@ -7,6 +7,7 @@ use Akeneo\Pim\ApiClient\Pagination\PageInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -75,7 +76,7 @@ public function upsert($familyCode, $familyVariantCode, array $data = []): int; * * @return Promise */ - public function upsertAsync($familyCode, $familyVariantCode, array $data = []): PromiseInterface; + public function upsertAsync($familyCode, $familyVariantCode, array $data = []): PromiseInterface|Promise; /** * Available since Akeneo PIM 2.0. @@ -134,5 +135,5 @@ public function upsertList($familyCode, $familyVariants): \Traversable; * * @return Promise */ - public function upsertAsyncList($familyCode, $familyVariants): PromiseInterface; + public function upsertAsyncList($familyCode, $familyVariants): PromiseInterface|Promise; } diff --git a/src/Api/Operation/UpsertableResourceInterface.php b/src/Api/Operation/UpsertableResourceInterface.php index a806b001..10fcb3ad 100644 --- a/src/Api/Operation/UpsertableResourceInterface.php +++ b/src/Api/Operation/UpsertableResourceInterface.php @@ -4,6 +4,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * API that can "upsert" a resource. @@ -37,5 +38,5 @@ public function upsert(string $code, array $data = []): int; * * @return Promise */ - public function upsertAsync(string $code, array $data = []): PromiseInterface; + public function upsertAsync(string $code, array $data = []): PromiseInterface|Promise; } diff --git a/src/Api/Operation/UpsertableResourceListInterface.php b/src/Api/Operation/UpsertableResourceListInterface.php index 2f5591db..6b9284ce 100644 --- a/src/Api/Operation/UpsertableResourceListInterface.php +++ b/src/Api/Operation/UpsertableResourceListInterface.php @@ -4,6 +4,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -33,7 +34,7 @@ public function upsertList(array|StreamInterface $resources): \Traversable; * * @throws HttpException * - * @return Promise returns a Promise + * @return PromiseInterface|Promise returns a Promise */ - public function upsertAsyncList(array|StreamInterface $resources): PromiseInterface; + public function upsertAsyncList(array|StreamInterface $resources): PromiseInterface|Promise; } diff --git a/src/Api/ProductApi.php b/src/Api/ProductApi.php index 7f5c0cc9..e8956b4d 100644 --- a/src/Api/ProductApi.php +++ b/src/Api/ProductApi.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -82,7 +83,7 @@ public function upsert(string $code, array $data = []): int return $this->resourceClient->upsertResource(static::PRODUCT_URI, [$code], $data); } - public function upsertAsync(string $code, array $data = []): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::PRODUCT_URI, [$code], $data); } @@ -103,7 +104,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::PRODUCTS_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCTS_URI, [], $resources); } diff --git a/src/Api/ProductModelApi.php b/src/Api/ProductModelApi.php index c2ee8982..2fcc56e5 100644 --- a/src/Api/ProductModelApi.php +++ b/src/Api/ProductModelApi.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -116,7 +117,7 @@ public function delete(string $code): int return $this->resourceClient->deleteResource(static::PRODUCT_MODEL_URI, [$code]); } - public function upsertAsync(string $code, array $data = []): PromiseInterface + public function upsertAsync(string $code, array $data = []): PromiseInterface|Promise { if (array_key_exists('code', $data)) { throw new InvalidArgumentException('The parameter "code" must not be defined in the data parameter'); @@ -127,7 +128,7 @@ public function upsertAsync(string $code, array $data = []): PromiseInterface return $this->resourceClient->upsertAsyncResource(static::PRODUCT_MODEL_URI, [$code], $data); } - public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCT_MODELS_URI, [], $resources); } diff --git a/src/Api/ProductUuidApi.php b/src/Api/ProductUuidApi.php index 2fcf01e1..5456b93a 100644 --- a/src/Api/ProductUuidApi.php +++ b/src/Api/ProductUuidApi.php @@ -11,6 +11,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\StreamInterface; /** @@ -65,7 +66,7 @@ public function upsert(string $uuid, array $data = []): int return $this->resourceClient->upsertResource(static::PRODUCT_UUID_URI, [$uuid], $data); } - public function upsertAsync(string $uuid, array $data = []): PromiseInterface + public function upsertAsync(string $uuid, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::PRODUCT_UUID_URI, [$uuid], $data); } @@ -80,7 +81,7 @@ public function upsertList($resources): \Traversable return $this->resourceClient->upsertStreamResourceList(static::PRODUCTS_UUID_URI, [], $resources); } - public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface + public function upsertAsyncList(StreamInterface|array $resources): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::PRODUCTS_UUID_URI, [], $resources); } diff --git a/src/Api/ProductUuidApiInterface.php b/src/Api/ProductUuidApiInterface.php index 195a86a4..cfa60de7 100644 --- a/src/Api/ProductUuidApiInterface.php +++ b/src/Api/ProductUuidApiInterface.php @@ -7,6 +7,7 @@ use Akeneo\Pim\ApiClient\Api\Operation\ListableResourceInterface; use Akeneo\Pim\ApiClient\Api\Operation\UpsertableResourceListInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @copyright 2022 Akeneo SAS (https://www.akeneo.com) @@ -20,7 +21,7 @@ public function create(string $uuid, array $data = []): int; public function upsert(string $uuid, array $data = []): int; - public function upsertAsync(string $uuid, array $data = []): PromiseInterface; + public function upsertAsync(string $uuid, array $data = []): PromiseInterface|Promise; public function delete(string $uuid): int; } diff --git a/src/Api/ReferenceEntityApi.php b/src/Api/ReferenceEntityApi.php index 2b55b6b8..6ff8f888 100644 --- a/src/Api/ReferenceEntityApi.php +++ b/src/Api/ReferenceEntityApi.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Tamara Robichet @@ -61,7 +62,7 @@ public function upsert(string $referenceEntityCode, array $data = []): int return $this->resourceClient->upsertResource(static::REFERENCE_ENTITY_URI, [$referenceEntityCode], $data); } - public function upsertAsync(string $referenceEntityCode, array $data = []): PromiseInterface + public function upsertAsync(string $referenceEntityCode, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_URI, [$referenceEntityCode], $data); } diff --git a/src/Api/ReferenceEntityApiInterface.php b/src/Api/ReferenceEntityApiInterface.php index 37f0c386..8bd151bd 100644 --- a/src/Api/ReferenceEntityApiInterface.php +++ b/src/Api/ReferenceEntityApiInterface.php @@ -7,6 +7,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * API to manage the reference entities. @@ -62,5 +63,5 @@ public function upsert(string $referenceEntityCode, array $data = []): int; * * @return Promise */ - public function upsertAsync(string $referenceEntityCode, array $data = []): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, array $data = []): PromiseInterface|Promise; } diff --git a/src/Api/ReferenceEntityAttributeApi.php b/src/Api/ReferenceEntityAttributeApi.php index a1db0d95..ad3eec32 100644 --- a/src/Api/ReferenceEntityAttributeApi.php +++ b/src/Api/ReferenceEntityAttributeApi.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Laurent Petard @@ -49,8 +50,12 @@ public function upsert(string $referenceEntityCode, string $attributeCode, array /** * {@inheritdoc} */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = []): PromiseInterface + public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = []): PromiseInterface|Promise { - return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_ATTRIBUTE_URI, [$referenceEntityCode, $attributeCode], $data); + return $this->resourceClient->upsertAsyncResource( + static::REFERENCE_ENTITY_ATTRIBUTE_URI, + [$referenceEntityCode, $attributeCode], + $data + ); } } diff --git a/src/Api/ReferenceEntityAttributeApiInterface.php b/src/Api/ReferenceEntityAttributeApiInterface.php index 27dfd288..d72387e1 100644 --- a/src/Api/ReferenceEntityAttributeApiInterface.php +++ b/src/Api/ReferenceEntityAttributeApiInterface.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Laurent Petard @@ -63,5 +64,5 @@ public function upsert(string $referenceEntityCode, string $attributeCode, array * * @return Promise */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = []): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, string $attributeCode, array $data = []): PromiseInterface|Promise; } diff --git a/src/Api/ReferenceEntityAttributeOptionApi.php b/src/Api/ReferenceEntityAttributeOptionApi.php index c36bc94b..30cf94df 100644 --- a/src/Api/ReferenceEntityAttributeOptionApi.php +++ b/src/Api/ReferenceEntityAttributeOptionApi.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Laurent Petard @@ -59,8 +60,12 @@ public function upsert(string $referenceEntityCode, string $attributeCode, strin /** * {@inheritdoc} */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface - { + public function upsertAsync( + string $referenceEntityCode, + string $attributeCode, + string $attributeOptionCode, + array $data = [] + ): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource( static::REFERENCE_ENTITY_ATTRIBUTE_OPTION_URI, [$referenceEntityCode, $attributeCode, $attributeOptionCode], diff --git a/src/Api/ReferenceEntityAttributeOptionApiInterface.php b/src/Api/ReferenceEntityAttributeOptionApiInterface.php index 8eb8f84f..730b03c1 100644 --- a/src/Api/ReferenceEntityAttributeOptionApiInterface.php +++ b/src/Api/ReferenceEntityAttributeOptionApiInterface.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Laurent Petard @@ -66,5 +67,10 @@ public function upsert(string $referenceEntityCode, string $attributeCode, strin * * @return Promise */ - public function upsertAsync(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode, array $data = []): PromiseInterface; + public function upsertAsync( + string $referenceEntityCode, + string $attributeCode, + string $attributeOptionCode, + array $data = [] + ): PromiseInterface|Promise; } diff --git a/src/Api/ReferenceEntityRecordApi.php b/src/Api/ReferenceEntityRecordApi.php index 91e42ab5..ad015a05 100644 --- a/src/Api/ReferenceEntityRecordApi.php +++ b/src/Api/ReferenceEntityRecordApi.php @@ -9,6 +9,7 @@ use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * @author Laurent Petard @@ -69,12 +70,12 @@ public function upsertList(string $referenceEntityCode, array $records): array return $this->resourceClient->upsertJsonResourceList(static::REFERENCE_ENTITY_RECORDS_URI, [$referenceEntityCode], $records); } - public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = []): PromiseInterface + public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::REFERENCE_ENTITY_RECORD_URI, [$referenceEntityCode, $recordCode], $data); } - public function upsertAsyncList(string $referenceEntityCode, array $records): PromiseInterface + public function upsertAsyncList(string $referenceEntityCode, array $records): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncJsonResourceList(static::REFERENCE_ENTITY_RECORDS_URI, [$referenceEntityCode], $records); } diff --git a/src/Api/ReferenceEntityRecordApiInterface.php b/src/Api/ReferenceEntityRecordApiInterface.php index 07f20115..1e2265e9 100644 --- a/src/Api/ReferenceEntityRecordApiInterface.php +++ b/src/Api/ReferenceEntityRecordApiInterface.php @@ -7,6 +7,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; /** * API to mange the reference entity records. @@ -66,7 +67,7 @@ public function upsert(string $referenceEntityCode, string $recordCode, array $d * * @return Promise */ - public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = []): PromiseInterface; + public function upsertAsync(string $referenceEntityCode, string $recordCode, array $data = []): PromiseInterface|Promise; /** * Updates or creates several reference entity records. @@ -90,5 +91,5 @@ public function upsertList(string $referenceEntityCode, array $records): array; * * @return Promise */ - public function upsertAsyncList(string $referenceEntityCode, array $records): PromiseInterface; + public function upsertAsyncList(string $referenceEntityCode, array $records): PromiseInterface|Promise; } diff --git a/src/Client/AuthenticatedHttpClient.php b/src/Client/AuthenticatedHttpClient.php index 086db3ba..6e93cec8 100644 --- a/src/Client/AuthenticatedHttpClient.php +++ b/src/Client/AuthenticatedHttpClient.php @@ -7,6 +7,7 @@ use Akeneo\Pim\ApiClient\Exception\UnprocessableEntityHttpException; use Akeneo\Pim\ApiClient\Security\Authentication; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\ResponseInterface; /** @@ -82,8 +83,8 @@ public function sendAsync( string $httpMethod, $uri, array $headers = [], - $body = null): PromiseInterface - { + $body = null + ): PromiseInterface|Promise { if (null === $this->authentication->getAccessToken()) { $tokens = $this->authenticationApi->authenticateByPassword( $this->authentication->getClientId(), diff --git a/src/Client/CachedResourceClient.php b/src/Client/CachedResourceClient.php index 6fa6b0bb..a31f8d30 100644 --- a/src/Client/CachedResourceClient.php +++ b/src/Client/CachedResourceClient.php @@ -6,6 +6,7 @@ use Akeneo\Pim\ApiClient\Cache\CacheInterface; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\ResponseInterface; /** @@ -77,8 +78,8 @@ public function upsertResource(string $uri, array $uriParameters = [], array $bo public function upsertAsyncResource( string $uri, array $uriParameters = [], - array $body = []): PromiseInterface - { + array $body = [] + ): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource($uri, $uriParameters, $body); } @@ -93,8 +94,8 @@ public function upsertStreamResourceList(string $uri, array $uriParameters = [], public function upsertAsyncStreamResourceList( string $uri, array $uriParameters = [], - $resources = []): PromiseInterface - { + $resources = [] + ): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncStreamResourceList($uri, $uriParameters, $resources); } @@ -109,8 +110,8 @@ public function upsertJsonResourceList(string $uri, array $uriParameters = [], a public function upsertAsyncJsonResourceList( string $uri, array $uriParameters = [], - array $resources = []): PromiseInterface - { + array $resources = [] + ): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncJsonResourceList($uri, $uriParameters, $resources); } @@ -149,8 +150,8 @@ public function upsertAndReturnResource(string $uri, array $uriParameters = [], public function upsertAsyncAndReturnPromise( string $uri, array $uriParameters = [], - array $body = []): PromiseInterface - { + array $body = [] + ): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncAndReturnPromise($uri, $uriParameters, $body); } } diff --git a/src/Client/ClientInterface.php b/src/Client/ClientInterface.php index fc864fa7..173c9277 100644 --- a/src/Client/ClientInterface.php +++ b/src/Client/ClientInterface.php @@ -5,10 +5,11 @@ namespace Akeneo\Pim\ApiClient\Client; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Client\ClientInterface as BaseClientInterface; use Psr\Http\Message\RequestInterface; interface ClientInterface extends BaseClientInterface { - public function sendAsyncRequest(RequestInterface $request): PromiseInterface; + public function sendAsyncRequest(RequestInterface $request): PromiseInterface|Promise; } diff --git a/src/Client/HttpClient.php b/src/Client/HttpClient.php index 1e133887..feb23e14 100644 --- a/src/Client/HttpClient.php +++ b/src/Client/HttpClient.php @@ -3,6 +3,7 @@ namespace Akeneo\Pim\ApiClient\Client; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\RequestFactoryInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -81,8 +82,8 @@ public function sendAsync( string $httpMethod, $uri, array $headers = [], - $body = null): PromiseInterface - { + $body = null + ): PromiseInterface|Promise { $request = $this->prepareRequest($httpMethod, $uri, $headers, $body); return $this->httpClient->sendAsyncRequest($request); diff --git a/src/Client/HttpClientInterface.php b/src/Client/HttpClientInterface.php index 55c0a1d8..208a37be 100644 --- a/src/Client/HttpClientInterface.php +++ b/src/Client/HttpClientInterface.php @@ -4,6 +4,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; use Psr\Http\Message\UriInterface; @@ -41,11 +42,12 @@ public function sendRequest(string $httpMethod, $uri, array $headers = [], $body * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return PromiseInterface|Promise */ public function sendAsync( string $httpMethod, $uri, array $headers = [], - $body = null): PromiseInterface; + $body = null + ): PromiseInterface|Promise; } diff --git a/src/Client/ResourceClient.php b/src/Client/ResourceClient.php index d3896025..c265ac33 100644 --- a/src/Client/ResourceClient.php +++ b/src/Client/ResourceClient.php @@ -10,6 +10,7 @@ use Akeneo\Pim\ApiClient\Stream\MultipartStreamBuilderFactory; use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponseFactory; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; @@ -128,8 +129,8 @@ public function upsertResource(string $uri, array $uriParameters = [], array $bo public function upsertAsyncResource( string $uri, array $uriParameters = [], - array $body = []): PromiseInterface - { + array $body = [] + ): PromiseInterface|Promise { return $this->sendAsyncUpsertRequest($uri, $uriParameters, $body); } @@ -146,12 +147,12 @@ public function upsertAndReturnResource(string $uri, array $uriParameters = [], public function upsertAsyncAndReturnPromise( string $uri, array $uriParameters = [], - array $body = []): PromiseInterface - { + array $body = [] + ): PromiseInterface|Promise { return $this->sendAsyncUpsertRequest($uri, $uriParameters, $body); } - public function prepareResourceListRequest(array|StreamInterface $resources): StreamInterface|string + public function prepareResourceListRequest($resources = []): StreamInterface|string { if (!is_array($resources) && !$resources instanceof StreamInterface) { throw new InvalidArgumentException('The parameter "resources" must be an array or an instance of StreamInterface.'); @@ -195,8 +196,8 @@ public function upsertStreamResourceList(string $uri, array $uriParameters = [], public function upsertAsyncStreamResourceList( string $uri, array $uriParameters = [], - $resources = []): PromiseInterface - { + $resources = [] + ): PromiseInterface|Promise { $body = $this->prepareResourceListRequest($resources); $uri = $this->uriGenerator->generate($uri, $uriParameters); return $this->httpClient->sendAsync( @@ -231,8 +232,8 @@ public function upsertJsonResourceList(string $uri, array $uriParameters = [], a public function upsertAsyncJsonResourceList( string $uri, array $uriParameters = [], - array $resources = []): PromiseInterface - { + array $resources = [] + ): PromiseInterface|Promise { $uri = $this->uriGenerator->generate($uri, $uriParameters); return $this->httpClient->sendAsync( 'PATCH', @@ -295,8 +296,8 @@ private function sendUpsertRequest(string $uri, array $uriParameters = [], array private function sendAsyncUpsertRequest( string $uri, array $uriParameters = [], - array $body = []): PromiseInterface - { + array $body = [] + ): PromiseInterface|Promise { unset($body['_links']); $uri = $this->uriGenerator->generate($uri, $uriParameters); diff --git a/src/Client/ResourceClientInterface.php b/src/Client/ResourceClientInterface.php index e23ff8a7..a66d7094 100644 --- a/src/Client/ResourceClientInterface.php +++ b/src/Client/ResourceClientInterface.php @@ -7,6 +7,7 @@ use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException; use GuzzleHttp\Promise\PromiseInterface; +use Http\Promise\Promise; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; @@ -119,12 +120,13 @@ public function upsertResource(string $uri, array $uriParameters = [], array $bo * * @throws HttpException If the request failed. * - * @return PromiseInterface + * @return PromiseInterface|Promise */ public function upsertAsyncResource( string $uri, array $uriParameters = [], - array $body = []): PromiseInterface; + array $body = [] + ); /** * Creates and returns a resource if it does not exist yet, otherwise updates partially and returns the resource. @@ -151,7 +153,8 @@ public function upsertAndReturnResource(string $uri, array $uriParameters = [], public function upsertAsyncAndReturnPromise( string $uri, array $uriParameters = [], - array $body = []): PromiseInterface; + array $body = [] + ); /** * Updates or creates several resources using a stream for the request and the response. @@ -179,12 +182,13 @@ public function upsertStreamResourceList(string $uri, array $uriParameters = [], * @throws HttpException If the request failed. * @throws InvalidArgumentException If the resources or any part thereof are invalid. * - * @return PromiseInterface returns a Promise + * @return PromiseInterface|Promise returns a Promise */ public function upsertAsyncStreamResourceList( string $uri, array $uriParameters = [], - $resources = []): PromiseInterface; + $resources = [] + ); /** * Updates or creates several resources using a single JSON string for the request and the response. @@ -210,12 +214,13 @@ public function upsertJsonResourceList(string $uri, array $uriParameters = [], a * @throws HttpException If the request failed. * @throws InvalidArgumentException If the resources or any part thereof are invalid. * - * @return PromiseInterface + * @return PromiseInterface|Promise */ public function upsertAsyncJsonResourceList( string $uri, array $uriParameters = [], - array $resources = []): PromiseInterface; + array $resources = [] + ); /** * Deletes a resource. diff --git a/tests/Api/AppCatalog/UpsertAppCatalogIntegration.php b/tests/Api/AppCatalog/UpsertAppCatalogIntegration.php index 15c2052a..bed0c01d 100644 --- a/tests/Api/AppCatalog/UpsertAppCatalogIntegration.php +++ b/tests/Api/AppCatalog/UpsertAppCatalogIntegration.php @@ -10,6 +10,7 @@ use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; use donatj\MockWebServer\ResponseStack; +use Http\Promise\Promise; use PHPUnit\Framework\Assert; /** @@ -42,4 +43,32 @@ public function test_upsert_catalog() Assert::assertSame(json_decode($expectedJson, true), $response); } + + public function test_upsert_async_catalog() + { + $catalogId = '12351d98-200e-4bbc-aa19-7fdda1bd14f2'; + $catalogData = ['name' => 'A catalog name']; + $expectedJson = <<server->setResponseOfPath( + '/' . sprintf(AppCatalogApi::APP_CATALOG_URI, $catalogId), + new ResponseStack( + new Response($expectedJson, [], HttpClient::HTTP_OK) + ) + ); + + $api = $this->createClientByPassword()->getAppCatalogApi(); + $promise = $api->upsertAsync($catalogId, $catalogData); + Assert::assertInstanceOf(Promise::class, $promise); + + $response = json_decode($promise->wait()->getBody()->getContents(), true); + + Assert::assertSame(json_decode($expectedJson, true), $response); + } } diff --git a/tests/Api/Asset/UpsertAssetIntegration.php b/tests/Api/Asset/UpsertAssetIntegration.php index d39a80fa..ca565211 100644 --- a/tests/Api/Asset/UpsertAssetIntegration.php +++ b/tests/Api/Asset/UpsertAssetIntegration.php @@ -9,6 +9,7 @@ use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; use donatj\MockWebServer\ResponseStack; +use Http\Promise\Promise; use PHPUnit\Framework\Assert; class UpsertAssetIntegration extends ApiTestCase @@ -48,4 +49,43 @@ public function test_upsert_asset() Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], json_encode($asset)); Assert::assertSame(204, $response); } + + public function test_upsert_async_asset() + { + $this->server->setResponseOfPath( + '/' . sprintf(AssetApi::ASSET_URI, 'packshot', 'sku_54628_telescope'), + new ResponseStack( + new Response('', [], 204) + ) + ); + + $asset = [ + "code" => "sku_54628_telescope", + "values" => [ + "media_preview" => [ + [ + "locale" => null, + "channel" => null, + "data" => "sku_54628_picture1.jpg" + ] + ], + "photographer" => [ + [ + "locale" => null, + "channel" => null, + "data" => "ben_levy" + ] + ] + ] + ]; + + $api = $this->createClientByPassword()->getAssetManagerApi(); + $promise = $api->upsertAsync('packshot', 'sku_54628_telescope', $asset); + Assert::assertInstanceOf(Promise::class, $promise); + + $response = $promise->wait(); + + Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], json_encode($asset)); + Assert::assertSame(204, $response->getStatusCode()); + } } diff --git a/tests/Api/Asset/UpsertListAssetIntegration.php b/tests/Api/Asset/UpsertListAssetIntegration.php index 9ff1737a..22ab2d25 100644 --- a/tests/Api/Asset/UpsertListAssetIntegration.php +++ b/tests/Api/Asset/UpsertListAssetIntegration.php @@ -5,10 +5,12 @@ namespace Akeneo\Pim\ApiClient\tests\Api\Asset; use Akeneo\Pim\ApiClient\Api\AssetManager\AssetApi; +use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponseFactory; use Akeneo\Pim\ApiClient\tests\Api\ApiTestCase; use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; use donatj\MockWebServer\ResponseStack; +use Http\Promise\Promise; use PHPUnit\Framework\Assert; class UpsertListAssetIntegration extends ApiTestCase @@ -93,4 +95,89 @@ public function test_upsert_a_list_of_assets() Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], json_encode($assets)); Assert::assertSame($expectedResponses, $responses); } + + public function test_upsert_async_a_list_of_assets() + { + $responseBody = <<server->setResponseOfPath( + '/' . sprintf(AssetApi::ASSETS_URI, 'packshot'), + new ResponseStack( + new Response($responseBody, [], 200) + ) + ); + + $assets = [ + [ + "code" => "sku_54628_telescope", + "values" => [ + "media_preview" => [ + [ + "locale" => null, + "channel" => null, + "data" => "sku_54628_picture1.jpg" + ] + ], + "photographer" => [ + [ + "locale" => null, + "channel" => null, + "data" => "ben_levy" + ] + ] + ] + ], + [ + "code" => "sku_45689_dobson", + "values" => [ + "media_preview" => [ + [ + "locale" => null, + "channel" => null, + "data" => "sku_45689_dobson_pic1.jpg" + ] + ], + "photographer" => [ + [ + "locale" => null, + "channel" => null, + "data" => "ben_levy" + ] + ] + ] + ] + ]; + + $expectedResponses = [ + [ + 'code' => 'sku_54628_telescope', + 'status_code' => 204 + ], + [ + 'code' => 'sku_45689_dobson', + 'status_code' => 201 + ], + ]; + + $api = $this->createClientByPassword()->getAssetManagerApi(); + $promise = $api->upsertAsyncList('packshot', $assets); + + Assert::assertInstanceOf(Promise::class, $promise); + + $responses = json_decode($promise->wait()->getBody()->getContents(), true); + + Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], json_encode($assets)); + Assert::assertSame($expectedResponses, $responses); + } } diff --git a/tests/Api/AssetAttribute/UpsertAssetFamilyAttributeIntegration.php b/tests/Api/AssetAttribute/UpsertAssetFamilyAttributeIntegration.php index b4b05b03..db1e3949 100644 --- a/tests/Api/AssetAttribute/UpsertAssetFamilyAttributeIntegration.php +++ b/tests/Api/AssetAttribute/UpsertAssetFamilyAttributeIntegration.php @@ -9,6 +9,7 @@ use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; use donatj\MockWebServer\ResponseStack; +use Http\Promise\Promise; use PHPUnit\Framework\Assert; class UpsertAssetFamilyAttributeIntegration extends ApiTestCase @@ -45,4 +46,40 @@ public function test_upsert_asset_family_attribute() ); Assert::assertSame(204, $response); } + + public function test_upsert_async_asset_family_attribute() + { + $this->server->setResponseOfPath( + '/' . sprintf(AssetAttributeApi::ASSET_ATTRIBUTE_URI, 'packshot', 'media_preview'), + new ResponseStack( + new Response('', [], 204) + ) + ); + + $assetFamilyAttribute = [ + 'code' => 'media_preview', + 'labels' => [ + 'en_US' => 'Media Preview' + ], + 'type' => 'media_link', + "value_per_locale" => false, + "value_per_channel" => false, + "is_required_for_completeness" => false, + "prefix" => "dam.com/my_assets/", + "suffix" => null, + "media_type" => "image" + ]; + + $api = $this->createClientByPassword()->getAssetAttributeApi(); + $promise = $api->upsertAsync('packshot', 'media_preview', $assetFamilyAttribute); + Assert::assertInstanceOf(Promise::class, $promise); + + $response = $promise->wait(); + + Assert::assertSame( + $this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], + json_encode($assetFamilyAttribute) + ); + Assert::assertSame(204, $response->getStatusCode()); + } } diff --git a/tests/Api/AssetAttributeOption/UpsertAssetFamilyAttributeOptionIntegration.php b/tests/Api/AssetAttributeOption/UpsertAssetFamilyAttributeOptionIntegration.php index d6364af5..e37fe43e 100644 --- a/tests/Api/AssetAttributeOption/UpsertAssetFamilyAttributeOptionIntegration.php +++ b/tests/Api/AssetAttributeOption/UpsertAssetFamilyAttributeOptionIntegration.php @@ -9,6 +9,7 @@ use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; use donatj\MockWebServer\ResponseStack; +use Http\Promise\Promise; use PHPUnit\Framework\Assert; class UpsertAssetFamilyAttributeOptionIntegration extends ApiTestCase @@ -44,4 +45,39 @@ public function test_upsert_asset_family_attribute_option() ); Assert::assertSame(204, $response); } + + public function test_upsert_async_asset_family_attribute_option() + { + $this->server->setResponseOfPath( + '/' . sprintf( + AssetAttributeOptionApi::ASSET_ATTRIBUTE_OPTION_URI, + 'packshot', + 'wearing_model_size', + 'size_27' + ), + new ResponseStack( + new Response('', [], 204) + ) + ); + + $assetFamilyAttributeOption = [ + "code" => "size_27", + "labels" => [ + "en_US" => "Size 27", + "fr_FR" => "Taille 36" + ] + ]; + + $api = $this->createClientByPassword()->getAssetAttributeOptionApi(); + $promise = $api->upsertAsync('packshot', 'wearing_model_size', 'size_27', $assetFamilyAttributeOption); + Assert::assertInstanceOf(Promise::class, $promise); + + $response = $promise->wait(); + + Assert::assertSame( + $this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], + json_encode($assetFamilyAttributeOption) + ); + Assert::assertSame(204, $response->getStatusCode()); + } } diff --git a/tests/Api/AssetFamily/UpsertAssetFamilyIntegration.php b/tests/Api/AssetFamily/UpsertAssetFamilyIntegration.php index 71043513..2e7d5983 100644 --- a/tests/Api/AssetFamily/UpsertAssetFamilyIntegration.php +++ b/tests/Api/AssetFamily/UpsertAssetFamilyIntegration.php @@ -7,6 +7,7 @@ use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; use donatj\MockWebServer\ResponseStack; +use Http\Promise\Promise; use PHPUnit\Framework\Assert; class UpsertAssetFamilyIntegration extends ApiTestCase @@ -33,4 +34,30 @@ public function test_upsert_asset_family() Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], json_encode($assetFamily)); Assert::assertSame(201, $response); } + + public function test_upsert_async_asset_family() + { + $this->server->setResponseOfPath( + '/' . sprintf(AssetFamilyApi::ASSET_FAMILY_URI, 'packshot'), + new ResponseStack( + new Response('', [], 201) + ) + ); + + $assetFamily = [ + 'code' => 'packshot', + 'labels' => [ + 'en_US' => 'Packshots' + ] + ]; + + $api = $this->createClientByPassword()->getAssetFamilyApi(); + $promise = $api->upsertAsync('packshot', $assetFamily); + Assert::assertInstanceOf(Promise::class, $promise); + + $response = $promise->wait(); + + Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], json_encode($assetFamily)); + Assert::assertSame(201, $response->getStatusCode()); + } } diff --git a/tests/Api/AssetReferenceFile/DownloadAssetReferenceFileIntegration.php b/tests/Api/AssetReferenceFile/DownloadAssetReferenceFileIntegration.php index 5e01783e..3b0e657c 100644 --- a/tests/Api/AssetReferenceFile/DownloadAssetReferenceFileIntegration.php +++ b/tests/Api/AssetReferenceFile/DownloadAssetReferenceFileIntegration.php @@ -3,6 +3,7 @@ namespace Akeneo\Pim\ApiClient\tests\Api\AssetReferenceFile; use Akeneo\Pim\ApiClient\Api\AssetReferenceFileApi; +use Akeneo\Pim\ApiClient\Exception\NotFoundHttpException; use Akeneo\Pim\ApiClient\tests\Api\ApiTestCase; use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; @@ -56,11 +57,9 @@ public function test_download_a_not_localizable_asset_reference_file() Assert::assertSame(file_get_contents($expectedFilePath), $downloadResponse->getBody()->getContents()); } - /** - * @expectedException \Akeneo\Pim\ApiClient\Exception\NotFoundHttpException - */ public function test_download_from_localizable_asset_not_found() { + self::expectException(NotFoundHttpException::class); $this->server->setResponseOfPath( '/' . sprintf(AssetReferenceFileApi::ASSET_REFERENCE_FILE_DOWNLOAD_URI, 'ziggy', 'en_US'), new ResponseStack( @@ -72,11 +71,9 @@ public function test_download_from_localizable_asset_not_found() $api->downloadFromLocalizableAsset('ziggy', 'en_US'); } - /** - * @expectedException \Akeneo\Pim\ApiClient\Exception\NotFoundHttpException - */ public function test_download_from_not_localizable_asset_not_found() { + self::expectException(NotFoundHttpException::class); $this->server->setResponseOfPath( '/' . sprintf( AssetReferenceFileApi::ASSET_REFERENCE_FILE_DOWNLOAD_URI, diff --git a/tests/Api/AssetReferenceFile/UploadAssetReferenceFileIntegration.php b/tests/Api/AssetReferenceFile/UploadAssetReferenceFileIntegration.php index a07b2c50..e9f206e9 100644 --- a/tests/Api/AssetReferenceFile/UploadAssetReferenceFileIntegration.php +++ b/tests/Api/AssetReferenceFile/UploadAssetReferenceFileIntegration.php @@ -3,6 +3,8 @@ namespace Akeneo\Pim\ApiClient\tests\v2_1\Api\AssetReferenceFile; use Akeneo\Pim\ApiClient\Api\AssetReferenceFileApi; +use Akeneo\Pim\ApiClient\Exception\NotFoundHttpException; +use Akeneo\Pim\ApiClient\Exception\UploadAssetReferenceFileErrorException; use Akeneo\Pim\ApiClient\tests\Api\ApiTestCase; use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; @@ -106,11 +108,10 @@ public function test_upload_from_resource_file() Assert::assertEquals($this->fakeUploadLocalizableInformations(), $assetReferenceFile); } - /** - * @expectedException \Akeneo\Pim\ApiClient\Exception\NotFoundHttpException - */ public function test_upload_for_an_unknown_asset() { + self::expectException(NotFoundHttpException::class); + $filePath = realpath(__DIR__ . '/../../fixtures/ziggy.png'); $this->server->setResponseOfPath( @@ -125,11 +126,10 @@ public function test_upload_for_an_unknown_asset() $api->uploadForLocalizableAsset($filePath, 'unknown_asset', 'en_US'); } - /** - * @expectedException \Akeneo\Pim\ApiClient\Exception\UploadAssetReferenceFileErrorException - */ public function test_upload_a_file_that_cannot_be_transformed_for_the_variations() { + self::expectException(UploadAssetReferenceFileErrorException::class); + $filePath = realpath(__DIR__ . '/../../fixtures/unicorn.png'); $this->server->setResponseOfPath( diff --git a/tests/Api/AssetVariationFile/DownloadAssetVariationFileApiIntegration.php b/tests/Api/AssetVariationFile/DownloadAssetVariationFileApiIntegration.php index 26561a96..d0990b5a 100644 --- a/tests/Api/AssetVariationFile/DownloadAssetVariationFileApiIntegration.php +++ b/tests/Api/AssetVariationFile/DownloadAssetVariationFileApiIntegration.php @@ -3,6 +3,7 @@ namespace Akeneo\Pim\ApiClient\tests\v2_1\Api\AssetVariationFile; use Akeneo\Pim\ApiClient\Api\AssetVariationFileApi; +use Akeneo\Pim\ApiClient\Exception\NotFoundHttpException; use Akeneo\Pim\ApiClient\tests\Api\ApiTestCase; use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; @@ -58,11 +59,10 @@ public function test_download_a_not_localizable_asset_variation_file() Assert::assertSame(file_get_contents($expectedFilePath), $downloadResponse->getBody()->getContents()); } - /** - * @expectedException \Akeneo\Pim\ApiClient\Exception\NotFoundHttpException - */ public function test_download_from_localizable_asset_not_found() { + self::expectException(NotFoundHttpException::class); + $this->server->setResponseOfPath( '/' . sprintf(AssetVariationFileApi::ASSET_VARIATION_FILE_DOWNLOAD_URI, 'ziggy', 'mobile', 'en_US'), new ResponseStack( @@ -74,11 +74,10 @@ public function test_download_from_localizable_asset_not_found() $api->downloadFromLocalizableAsset('ziggy', 'mobile', 'en_US'); } - /** - * @expectedException \Akeneo\Pim\ApiClient\Exception\NotFoundHttpException - */ public function test_download_from_not_localizable_asset_not_found() { + self::expectException(NotFoundHttpException::class); + $this->server->setResponseOfPath( '/' . sprintf( AssetVariationFileApi::ASSET_VARIATION_FILE_DOWNLOAD_URI, diff --git a/tests/Api/AssetVariationFile/UploadAssetVariationFileApiIntegration.php b/tests/Api/AssetVariationFile/UploadAssetVariationFileApiIntegration.php index 58a0502a..7082fd01 100644 --- a/tests/Api/AssetVariationFile/UploadAssetVariationFileApiIntegration.php +++ b/tests/Api/AssetVariationFile/UploadAssetVariationFileApiIntegration.php @@ -3,6 +3,8 @@ namespace Akeneo\Pim\ApiClient\tests\v2_1\Api\AssetVariationFile; use Akeneo\Pim\ApiClient\Api\AssetVariationFileApi; +use Akeneo\Pim\ApiClient\Exception\NotFoundHttpException; +use Akeneo\Pim\ApiClient\Exception\UnprocessableEntityHttpException; use Akeneo\Pim\ApiClient\tests\Api\ApiTestCase; use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; @@ -108,11 +110,10 @@ public function test_upload_from_resource_file() Assert::assertEquals($this->fakeUploadLocalizableInformations(), $assetReferenceFile); } - /** - * @expectedException \Akeneo\Pim\ApiClient\Exception\NotFoundHttpException - */ public function test_upload_for_an_unknown_asset() { + self::expectException(NotFoundHttpException::class); + $filePath = realpath(__DIR__ . '/../../fixtures/ziggy.png'); $this->server->setResponseOfPath( @@ -127,11 +128,9 @@ public function test_upload_for_an_unknown_asset() $api->uploadForLocalizableAsset($filePath, 'unknown_asset', 'ecommerce', 'en_US'); } - /** - * @expectedException \Akeneo\Pim\ApiClient\Exception\UnprocessableEntityHttpException - */ public function test_upload_for_an_asset_that_should_be_localizable() { + self::expectException(UnprocessableEntityHttpException::class); $filePath = realpath(__DIR__ . '/../../fixtures/unicorn.png'); $this->server->setResponseOfPath( diff --git a/tests/Api/ProductUuid/UpsertListProductUuidIntegration.php b/tests/Api/ProductUuid/UpsertListProductUuidIntegration.php index 20870cd3..86efabf4 100644 --- a/tests/Api/ProductUuid/UpsertListProductUuidIntegration.php +++ b/tests/Api/ProductUuid/UpsertListProductUuidIntegration.php @@ -4,11 +4,13 @@ use Akeneo\Pim\ApiClient\Api\ProductUuidApi; use Akeneo\Pim\ApiClient\Client\HttpClient; +use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponseFactory; use Akeneo\Pim\ApiClient\tests\Api\ApiTestCase; use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; use donatj\MockWebServer\ResponseStack; use Http\Discovery\Psr17FactoryDiscovery; +use Http\Promise\Promise; use PHPUnit\Framework\Assert; /** @@ -56,6 +58,39 @@ public function test_upsert_list() ], $responseLines[2]); } + public function test_upsert_async_list() + { + $upsertListResponseFactory = new UpsertResourceListResponseFactory(); + $api = $this->createClientByPassword()->getProductUuidApi(); + $promise = $api->upsertAsyncList($this->getProductToUpsert()); + + Assert::assertInstanceOf(Promise::class, $promise); + + $response = $upsertListResponseFactory->create($promise->wait()->getBody()); + + Assert::assertSame( + $this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], + $this->getProductToUpsertJson() + ); + + Assert::assertInstanceOf('\Iterator', $response); + + $responseLines = iterator_to_array($response); + Assert::assertCount(2, $responseLines); + + Assert::assertSame([ + 'line' => 1, + 'uuid' => '12951d98-210e-4bRC-ab18-7fdgf1bd14f3', + 'status_code' => HttpClient::HTTP_NO_CONTENT, + ], $responseLines[1]); + + Assert::assertSame([ + 'line' => 2, + 'uuid' => '12951d98-210e-4bRC-ab18-7fdgf1bd14f4', + 'status_code' => HttpClient::HTTP_CREATED, + ], $responseLines[2]); + } + public function test_upsert_list_from_stream() { $resources = fopen('php://memory', 'w+'); @@ -89,6 +124,44 @@ public function test_upsert_list_from_stream() ], $responseLines[2]); } + public function test_upsert_async_list_from_stream() + { + $upsertListResponseFactory = new UpsertResourceListResponseFactory(); + $resources = fopen('php://memory', 'w+'); + fwrite($resources, $this->getProductToUpsertJson()); + rewind($resources); + + $streamedResources = Psr17FactoryDiscovery::findStreamFactory()->createStreamFromResource($resources); + $api = $this->createClientByPassword()->getProductUuidApi(); + $promise = $api->upsertAsyncList($streamedResources); + + Assert::assertInstanceOf(Promise::class, $promise); + + $response = $upsertListResponseFactory->create($promise->wait()->getBody()); + + Assert::assertSame( + $this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], + $this->getProductToUpsertJson() + ); + + Assert::assertInstanceOf('\Iterator', $response); + + $responseLines = iterator_to_array($response); + Assert::assertCount(2, $responseLines); + + Assert::assertSame([ + 'line' => 1, + 'uuid' => '12951d98-210e-4bRC-ab18-7fdgf1bd14f3', + 'status_code' => HttpClient::HTTP_NO_CONTENT, + ], $responseLines[1]); + + Assert::assertSame([ + 'line' => 2, + 'uuid' => '12951d98-210e-4bRC-ab18-7fdgf1bd14f4', + 'status_code' => HttpClient::HTTP_CREATED, + ], $responseLines[2]); + } + private function getProductToUpsertJson(): string { return <<server->setResponseOfPath( + '/' . sprintf(ProductUuidApi::PRODUCT_UUID_URI, '12951d98-210e-4bRC-ab18-7fdgf1bd14f3'), + new ResponseStack( + new Response('', [], HttpClient::HTTP_NO_CONTENT) + ) + ); + + $api = $this->createClientByPassword()->getProductUuidApi(); + + $parameters = [ + 'identifier' => 'black_docks', + 'enabled' => false, + 'values' => [ + 'name' => [ + [ + 'locale' => 'en_US', + 'scope' => null, + 'data' => 'Black Docks', + ], + ], + ] + ]; + + $promise = $api->upsertAsync('12951d98-210e-4bRC-ab18-7fdgf1bd14f3', $parameters); + Assert::assertInstanceOf(Promise::class, $promise); + + $response = $promise->wait(); + + Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], json_encode($parameters)); + + Assert::assertSame(HttpClient::HTTP_NO_CONTENT, $response->getStatusCode()); + } } diff --git a/tests/Api/ReferenceEntity/UpsertReferenceEntityIntegration.php b/tests/Api/ReferenceEntity/UpsertReferenceEntityIntegration.php index a9f96d3c..92632e57 100644 --- a/tests/Api/ReferenceEntity/UpsertReferenceEntityIntegration.php +++ b/tests/Api/ReferenceEntity/UpsertReferenceEntityIntegration.php @@ -7,6 +7,7 @@ use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; use donatj\MockWebServer\ResponseStack; +use Http\Promise\Promise; use PHPUnit\Framework\Assert; class UpsertReferenceEntityIntegration extends ApiTestCase @@ -33,4 +34,31 @@ public function test_upsert_reference_entity() Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], json_encode($referenceEntity)); Assert::assertSame(204, $response); } + + public function test_upsert_async_reference_entity() + { + $this->server->setResponseOfPath( + '/' . sprintf(ReferenceEntityApi::REFERENCE_ENTITY_URI, 'brand'), + new ResponseStack( + new Response('', [], 204) + ) + ); + + $referenceEntity = [ + 'code' => 'brand', + 'labels' => [ + 'en_US' => 'Brand' + ] + ]; + + $api = $this->createClientByPassword()->getReferenceEntityApi(); + $promise = $api->upsertAsync('brand', $referenceEntity); + + Assert::assertInstanceOf(Promise::class, $promise); + + $response = $promise->wait(); + + Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], json_encode($referenceEntity)); + Assert::assertSame(204, $response->getStatusCode()); + } } diff --git a/tests/Api/ReferenceEntityRecord/UpsertListReferenceEntityRecordIntegration.php b/tests/Api/ReferenceEntityRecord/UpsertListReferenceEntityRecordIntegration.php index 8f11902a..861997bd 100644 --- a/tests/Api/ReferenceEntityRecord/UpsertListReferenceEntityRecordIntegration.php +++ b/tests/Api/ReferenceEntityRecord/UpsertListReferenceEntityRecordIntegration.php @@ -3,10 +3,12 @@ namespace Akeneo\Pim\ApiClient\tests\Api\ReferenceEntityRecord; use Akeneo\Pim\ApiClient\Api\ReferenceEntityRecordApi; +use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponseFactory; use Akeneo\Pim\ApiClient\tests\Api\ApiTestCase; use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; use donatj\MockWebServer\ResponseStack; +use Http\Promise\Promise; use PHPUnit\Framework\Assert; class UpsertListReferenceEntityRecordIntegration extends ApiTestCase @@ -77,4 +79,74 @@ public function test_upsert_a_list_of_reference_entity_records() Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], json_encode($records)); Assert::assertSame($expectedResponses, $responses); } + + public function test_upsert_async_a_list_of_reference_entity_records() + { + $responseBody = <<server->setResponseOfPath( + '/' . sprintf(ReferenceEntityRecordApi::REFERENCE_ENTITY_RECORDS_URI, 'designer'), + new ResponseStack( + new Response($responseBody, [], 200) + ) + ); + + $records = [ + [ + 'code' => 'starck', + 'values' => [ + 'label' => [ + [ + 'channel' => null, + 'locale' => 'en_US', + 'data' => 'Philippe Starck' + ], + ] + ] + ], + [ + 'code' => 'dyson', + 'values' => [ + 'label' => [ + [ + 'channel' => null, + 'locale' => 'en_US', + 'data' => 'James Dyson' + ], + ] + ] + ] + ]; + + $expectedResponses = [ + [ + 'code' => 'starck', + 'status_code' => 204 + ], + [ + 'code' => 'dyson', + 'status_code' => 201 + ], + ]; + + $api = $this->createClientByPassword()->getReferenceEntityRecordApi(); + $promise = $api->upsertAsyncList('designer', $records); + Assert::assertInstanceOf(Promise::class, $promise); + + $responses = json_decode($promise->wait()->getBody()->getContents(), true); + + Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], json_encode($records)); + Assert::assertSame($expectedResponses, $responses); + } } diff --git a/tests/Api/ReferenceEntityRecord/UpsertReferenceEntityRecordIntegration.php b/tests/Api/ReferenceEntityRecord/UpsertReferenceEntityRecordIntegration.php index 764523d4..5776b048 100644 --- a/tests/Api/ReferenceEntityRecord/UpsertReferenceEntityRecordIntegration.php +++ b/tests/Api/ReferenceEntityRecord/UpsertReferenceEntityRecordIntegration.php @@ -7,6 +7,7 @@ use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; use donatj\MockWebServer\ResponseStack; +use Http\Promise\Promise; use PHPUnit\Framework\Assert; class UpsertReferenceEntityRecordIntegration extends ApiTestCase @@ -39,4 +40,36 @@ public function test_upsert_reference_entity_record() Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], json_encode($recordData)); Assert::assertSame(204, $response); } + + public function test_upsert_async_reference_entity_record() + { + $this->server->setResponseOfPath( + '/' . sprintf(ReferenceEntityRecordApi::REFERENCE_ENTITY_RECORD_URI, 'designer', 'starck'), + new ResponseStack( + new Response('', [], 204) + ) + ); + + $recordData = [ + 'code' => 'starck', + 'values' => [ + 'label' => [ + [ + 'channel' => null, + 'locale' => 'en_US', + 'data' => 'Philippe Starck' + ], + ] + ] + ]; + + $api = $this->createClientByPassword()->getReferenceEntityRecordApi(); + $promise = $api->upsertAsync('designer', 'starck', $recordData); + Assert::assertInstanceOf(Promise::class, $promise); + + $response = $promise->wait(); + + Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], json_encode($recordData)); + Assert::assertSame(204, $response->getStatusCode()); + } } diff --git a/tests/Api/UpsertListProductTest.php b/tests/Api/UpsertListProductTest.php index ecad688b..40a148a5 100644 --- a/tests/Api/UpsertListProductTest.php +++ b/tests/Api/UpsertListProductTest.php @@ -3,10 +3,12 @@ namespace Akeneo\Pim\ApiClient\tests\Api; use Akeneo\Pim\ApiClient\Api\ProductApi; +use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponseFactory; use donatj\MockWebServer\RequestInfo; use donatj\MockWebServer\Response; use donatj\MockWebServer\ResponseStack; use Http\Discovery\Psr17FactoryDiscovery; +use Http\Promise\Promise; use PHPUnit\Framework\Assert; class UpsertListProductTest extends ApiTestCase @@ -47,6 +49,36 @@ public function test_upsert_list() ], $responseLines[2]); } + public function test_upsert_async_list() + { + $upsertListResponseFactory = new UpsertResourceListResponseFactory(); + $api = $this->createClientByPassword()->getProductApi(); + $promise = $api->upsertAsyncList($this->getProductToUpsert()); + + Assert::assertInstanceOf(Promise::class, $promise); + + $response = $upsertListResponseFactory->create($promise->wait()->getBody()); + + Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], $this->getProductToUpsertJson()); + + Assert::assertInstanceOf('\Iterator', $response); + + $responseLines = iterator_to_array($response); + Assert::assertCount(2, $responseLines); + + Assert::assertSame([ + 'line' => 1, + 'identifier' => 'docks_black', + 'status_code' => 204, + ], $responseLines[1]); + + Assert::assertSame([ + 'line' => 2, + 'identifier' => 'pumps', + 'status_code' => 201, + ], $responseLines[2]); + } + public function test_upsert_list_from_stream() { $resources = fopen('php://memory', 'w+'); @@ -77,6 +109,42 @@ public function test_upsert_list_from_stream() ], $responseLines[2]); } + public function test_upsert_async_list_from_stream() + { + $resources = fopen('php://memory', 'w+'); + fwrite($resources, $this->getProductToUpsertJson()); + rewind($resources); + + $streamedResources = Psr17FactoryDiscovery::findStreamFactory()->createStreamFromResource($resources); + + $upsertListResponseFactory = new UpsertResourceListResponseFactory(); + $api = $this->createClientByPassword()->getProductApi(); + $promise = $api->upsertAsyncList($streamedResources); + + Assert::assertInstanceOf(Promise::class, $promise); + + $response = $upsertListResponseFactory->create($promise->wait()->getBody()); + + Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], $this->getProductToUpsertJson()); + + Assert::assertInstanceOf('\Iterator', $response); + + $responseLines = iterator_to_array($response); + Assert::assertCount(2, $responseLines); + + Assert::assertSame([ + 'line' => 1, + 'identifier' => 'docks_black', + 'status_code' => 204, + ], $responseLines[1]); + + Assert::assertSame([ + 'line' => 2, + 'identifier' => 'pumps', + 'status_code' => 201, + ], $responseLines[2]); + } + private function getProductToUpsertJson(): string { return <<server->setResponseOfPath( + '/' . sprintf(ProductApi::PRODUCT_URI, 'docks_black'), + new ResponseStack( + new Response('', [], 204) + ) + ); + $api = $this->createClientByPassword()->getProductApi(); + $parameters = [ + 'enabled' => false, + 'values' => [ + 'name' => [ + [ + 'locale' => 'en_US', + 'scope' => null, + 'data' => 'Black Docks', + ], + ], + ] + ]; + + $promise = $api->upsertAsync('docks_black', $parameters); + Assert::assertInstanceOf(Promise::class, $promise); + + $response = $promise->wait(); + + Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_INPUT], json_encode($parameters)); + Assert::assertSame(204, $response->getStatusCode()); + } } diff --git a/tests/Client/CachedResourceClientTest.php b/tests/Client/CachedResourceClientTest.php index 443a0a6a..60f3beb4 100644 --- a/tests/Client/CachedResourceClientTest.php +++ b/tests/Client/CachedResourceClientTest.php @@ -6,14 +6,14 @@ use Akeneo\Pim\ApiClient\Cache\CacheInterface; use Akeneo\Pim\ApiClient\Client\CachedResourceClient; -use Akeneo\Pim\ApiClient\Client\ResourceClient; +use Akeneo\Pim\ApiClient\Client\ResourceClientInterface; use Akeneo\Pim\ApiClient\tests\Api\ApiTestCase; class CachedResourceClientTest extends ApiTestCase { public function test_get_cached_resource(): void { - $resourceClient = $this->createMock(ResourceClient::class); + $resourceClient = $this->createMock(ResourceClientInterface::class); $mockCache = $this->createMock(CacheInterface::class); $uri = 'uri'; From dd7987ad65841b0063f1956acbe88d03b2fd3105 Mon Sep 17 00:00:00 2001 From: gwendalaubert Date: Thu, 29 Jun 2023 17:05:12 +0200 Subject: [PATCH 10/10] Apply suggestions from code review Co-authored-by: Samuel Gomis --- src/Api/AssetManager/AssetAttributeOptionApi.php | 3 +++ src/Api/AttributeOptionApi.php | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/Api/AssetManager/AssetAttributeOptionApi.php b/src/Api/AssetManager/AssetAttributeOptionApi.php index 059d26d7..46d2c704 100644 --- a/src/Api/AssetManager/AssetAttributeOptionApi.php +++ b/src/Api/AssetManager/AssetAttributeOptionApi.php @@ -52,6 +52,9 @@ public function upsert(string $assetFamilyCode, string $attributeCode, string $a ); } + /** + * {@inheritdoc} + */ public function upsertAsync( string $assetFamilyCode, string $attributeCode, diff --git a/src/Api/AttributeOptionApi.php b/src/Api/AttributeOptionApi.php index a964d0d3..9e141bc6 100644 --- a/src/Api/AttributeOptionApi.php +++ b/src/Api/AttributeOptionApi.php @@ -94,11 +94,17 @@ public function upsertList($attributeCode, $attributeOptions): \Traversable return $this->resourceClient->upsertStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions); } + /** + * {@inheritdoc} + */ public function upsertAsyncList($attributeCode, $attributeOptions): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncStreamResourceList(static::ATTRIBUTE_OPTIONS_URI, [$attributeCode], $attributeOptions); } + /** + * {@inheritdoc} + */ public function upsertAsync($attributeCode, $attributeOptionCode, array $data = []): PromiseInterface|Promise { return $this->resourceClient->upsertAsyncResource(static::ATTRIBUTE_OPTION_URI, [$attributeCode, $attributeOptionCode], $data);