Skip to content

Commit

Permalink
Merge pull request #11 from justbetter/feature/documentation
Browse files Browse the repository at this point in the history
Updated doc blocks and introduced attributes
  • Loading branch information
VincentBean authored Nov 20, 2023
2 parents 180fa32 + 301f95e commit ddce84b
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1, 8.2]
php: [8.2]
laravel: [10.*]
akeneo: [v11.*]
stability: [prefer-stable]
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"akeneo/api-php-client": "^11.0",
"guzzlehttp/guzzle": "^7.5",
"laravel/framework": "^10.0"
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ parameters:
- tests
level: 8
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
7 changes: 4 additions & 3 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
Expand All @@ -9,9 +9,10 @@
<directory>./tests/*</directory>
</testsuite>
</testsuites>
<coverage>
<coverage/>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
</source>
</phpunit>
98 changes: 89 additions & 9 deletions src/Client/Akeneo.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,104 @@
namespace JustBetter\AkeneoClient\Client;

use Akeneo\Pim\ApiClient\AkeneoPimClientInterface;
use Akeneo\Pim\ApiClient\Api\AppCatalog\AppCatalogApiInterface;
use Akeneo\Pim\ApiClient\Api\AppCatalog\AppCatalogProductApiInterface;
use Akeneo\Pim\ApiClient\Api\AssetApiInterface;
use Akeneo\Pim\ApiClient\Api\AssetCategoryApiInterface;
use Akeneo\Pim\ApiClient\Api\AssetManager\AssetApiInterface as AssetManagerApiInterface;
use Akeneo\Pim\ApiClient\Api\AssetManager\AssetAttributeApiInterface;
use Akeneo\Pim\ApiClient\Api\AssetManager\AssetAttributeOptionApiInterface;
use Akeneo\Pim\ApiClient\Api\AssetManager\AssetFamilyApiInterface;
use Akeneo\Pim\ApiClient\Api\AssetManager\AssetMediaFileApiInterface;
use Akeneo\Pim\ApiClient\Api\AssetReferenceFileApiInterface;
use Akeneo\Pim\ApiClient\Api\AssetTagApiInterface;
use Akeneo\Pim\ApiClient\Api\AssetVariationFileApiInterface;
use Akeneo\Pim\ApiClient\Api\AssociationTypeApiInterface;
use Akeneo\Pim\ApiClient\Api\AttributeApiInterface;
use Akeneo\Pim\ApiClient\Api\AttributeGroupApiInterface;
use Akeneo\Pim\ApiClient\Api\AttributeOptionApiInterface;
use Akeneo\Pim\ApiClient\Api\CategoryApiInterface;
use Akeneo\Pim\ApiClient\Api\ChannelApiInterface;
use Akeneo\Pim\ApiClient\Api\CurrencyApiInterface;
use Akeneo\Pim\ApiClient\Api\FamilyApiInterface;
use Akeneo\Pim\ApiClient\Api\FamilyVariantApiInterface;
use Akeneo\Pim\ApiClient\Api\LocaleApiInterface;
use Akeneo\Pim\ApiClient\Api\MeasureFamilyApiInterface;
use Akeneo\Pim\ApiClient\Api\MeasurementFamilyApiInterface;
use Akeneo\Pim\ApiClient\Api\MediaFileApiInterface;
use Akeneo\Pim\ApiClient\Api\Operation\DownloadableResourceInterface;
use Akeneo\Pim\ApiClient\Api\ProductApiInterface;
use Akeneo\Pim\ApiClient\Api\ProductDraftApiInterface;
use Akeneo\Pim\ApiClient\Api\ProductDraftUuidApiInterface;
use Akeneo\Pim\ApiClient\Api\ProductModelApiInterface;
use Akeneo\Pim\ApiClient\Api\ProductModelDraftApiInterface;
use Akeneo\Pim\ApiClient\Api\ProductUuidApiInterface;
use Akeneo\Pim\ApiClient\Api\PublishedProductApiInterface;
use Akeneo\Pim\ApiClient\Api\ReferenceEntityApiInterface;
use Akeneo\Pim\ApiClient\Api\ReferenceEntityAttributeApiInterface;
use Akeneo\Pim\ApiClient\Api\ReferenceEntityAttributeOptionApiInterface;
use Akeneo\Pim\ApiClient\Api\ReferenceEntityMediaFileApiInterface;
use Akeneo\Pim\ApiClient\Api\ReferenceEntityRecordApiInterface;
use Illuminate\Support\Facades\Http;
use JustBetter\AkeneoClient\Exceptions\AkeneoException;
use SensitiveParameter;

/** @mixin AkeneoPimClientInterface */
/**
* @method ?string getToken()
* @method ?string getRefreshToken()
* @method ProductApiInterface getProductApi()
* @method CategoryApiInterface getCategoryApi()
* @method DownloadableResourceInterface getCategoryMediaFileApi()
* @method AttributeApiInterface getAttributeApi()
* @method AttributeOptionApiInterface getAttributeOptionApi()
* @method AttributeGroupApiInterface getAttributeGroupApi()
* @method FamilyApiInterface getFamilyApi()
* @method MediaFileApiInterface getProductMediaFileApi()
* @method LocaleApiInterface getLocaleApi()
* @method ChannelApiInterface getChannelApi()
* @method CurrencyApiInterface getCurrencyApi()
* @method MeasureFamilyApiInterface getMeasureFamilyApi()
* @method MeasurementFamilyApiInterface getMeasurementFamilyApi()
* @method AssociationTypeApiInterface getAssociationTypeApi()
* @method FamilyVariantApiInterface getFamilyVariantApi()
* @method ProductModelApiInterface getProductModelApi()
* @method PublishedProductApiInterface getPublishedProductApi()
* @method ProductModelDraftApiInterface getProductModelDraftApi()
* @method ProductDraftApiInterface getProductDraftApi()
* @method AssetApiInterface getAssetApi()
* @method AssetCategoryApiInterface getAssetCategoryApi()
* @method AssetTagApiInterface getAssetTagApi()
* @method AssetReferenceFileApiInterface getAssetReferenceFileApi()
* @method AssetVariationFileApiInterface getAssetVariationFileApi()
* @method ReferenceEntityRecordApiInterface getReferenceEntityRecordApi()
* @method ReferenceEntityMediaFileApiInterface getReferenceEntityMediaFileApi()
* @method ReferenceEntityAttributeApiInterface getReferenceEntityAttributeApi()
* @method ReferenceEntityAttributeOptionApiInterface getReferenceEntityAttributeOptionApi()
* @method ReferenceEntityApiInterface getReferenceEntityApi()
* @method AssetManagerApiInterface getAssetManagerApi()
* @method AssetFamilyApiInterface getAssetFamilyApi()
* @method AssetAttributeApiInterface getAssetAttributeApi()
* @method AssetAttributeOptionApiInterface getAssetAttributeOptionApi()
* @method AssetMediaFileApiInterface getAssetMediaFileApi()
* @method ProductUuidApiInterface getProductUuidApi()
* @method ProductDraftUuidApiInterface getProductDraftUuidApi()
* @method AppCatalogApiInterface getAppCatalogApi()
* @method AppCatalogProductApiInterface getAppCatalogProductApi()
*/
class Akeneo
{
protected AkeneoPimClientInterface $client;

public function __construct(string $url, string $clientId, string $secret, string $username, string $password)
{
public function __construct(
string $url,
string $clientId,
#[SensitiveParameter] string $secret,
string $username,
#[SensitiveParameter] string $password
) {
$clientBuilder = new ClientBuilder($url);

$this->client = $clientBuilder->buildAuthenticatedByPassword(
clientId: $clientId,
secret: $secret,
username: $username,
password: $password
);
$this->client = $clientBuilder->buildAuthenticatedByPassword($clientId, $secret, $username, $password);
}

public function __call(string $method, array $args): mixed
Expand Down

0 comments on commit ddce84b

Please sign in to comment.