Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ If you don't have any client id, let's take a look at [this page](https://api.ak

require_once __DIR__ . '/vendor/autoload.php';

$clientBuilder = new \Akeneo\Pim\AkeneoPimClientBuilder('http://localhost/');
$clientBuilder = new \Akeneo\Pim\ApiClient\AkeneoPimClientBuilder('http://localhost/');
$client = $clientBuilder->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
```

Expand Down Expand Up @@ -69,7 +69,7 @@ echo $product['identifier']; // display "top"
#### By getting pages

```php
$searchBuilder = new \Akeneo\Pim\Search\SearchBuilder();
$searchBuilder = new \Akeneo\Pim\ApiClient\Search\SearchBuilder();
$searchBuilder->addFilter('enabled', '=', true);
$searchFilters = $searchBuilder->getFilters();

Expand All @@ -90,7 +90,7 @@ $firstPage = $nextPage->getPreviousPage();
#### By getting a cursor

```php
$searchBuilder = new \Akeneo\Pim\Search\SearchBuilder();
$searchBuilder = new \Akeneo\Pim\ApiClient\Search\SearchBuilder();
$searchBuilder->addFilter('enabled', '=', true);
$searchFilters = $searchBuilder->getFilters();

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
],
"autoload": {
"psr-4": {
"Akeneo\\Pim\\": "src/"
"Akeneo\\Pim\\ApiClient\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Akeneo\\Pim\\tests\\": "tests/"
"Akeneo\\Pim\\ApiClient\\tests\\": "tests/"
}
},
"require": {
Expand Down
4 changes: 2 additions & 2 deletions phpspec.yml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Rename this file in phpspec.yml to customize the phpspec configuration
suites:
AkeneoPimClient:
namespace: Akeneo\Pim
psr4_prefix: Akeneo\Pim
namespace: Akeneo\Pim\ApiClient
psr4_prefix: Akeneo\Pim\ApiClient
38 changes: 19 additions & 19 deletions spec/AkeneoPimClientSpec.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php

namespace spec\Akeneo\Pim;

use Akeneo\Pim\AkeneoPimClient;
use Akeneo\Pim\AkeneoPimClientInterface;
use Akeneo\Pim\Api\AssociationTypeApiInterface;
use Akeneo\Pim\Api\AttributeApiInterface;
use Akeneo\Pim\Api\AttributeGroupApi;
use Akeneo\Pim\Api\AttributeOptionApiInterface;
use Akeneo\Pim\Api\CategoryApiInterface;
use Akeneo\Pim\Api\ChannelApiInterface;
use Akeneo\Pim\Api\CurrencyApiInterface;
use Akeneo\Pim\Api\FamilyApiInterface;
use Akeneo\Pim\Api\FamilyVariantApiInterface;
use Akeneo\Pim\Api\LocaleApiInterface;
use Akeneo\Pim\Api\MeasureFamilyApiInterface;
use Akeneo\Pim\Api\MediaFileApiInterface;
use Akeneo\Pim\Api\ProductApiInterface;
use Akeneo\Pim\Api\ProductModelApiInterface;
use Akeneo\Pim\Security\Authentication;
namespace spec\Akeneo\Pim\ApiClient;

use Akeneo\Pim\ApiClient\AkeneoPimClient;
use Akeneo\Pim\ApiClient\AkeneoPimClientInterface;
use Akeneo\Pim\ApiClient\Api\AssociationTypeApiInterface;
use Akeneo\Pim\ApiClient\Api\AttributeApiInterface;
use Akeneo\Pim\ApiClient\Api\AttributeGroupApi;
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\MediaFileApiInterface;
use Akeneo\Pim\ApiClient\Api\ProductApiInterface;
use Akeneo\Pim\ApiClient\Api\ProductModelApiInterface;
use Akeneo\Pim\ApiClient\Security\Authentication;
use PhpSpec\ObjectBehavior;

class AkeneoPimClientSpec extends ObjectBehavior
Expand Down
32 changes: 19 additions & 13 deletions spec/Api/AssociationTypeApiSpec.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
<?php

namespace spec\Akeneo\Pim\Api;

use Akeneo\Pim\Api\AssociationTypeApi;
use Akeneo\Pim\Api\AssociationTypeApiInterface;
use Akeneo\Pim\Api\GettableResourceInterface;
use Akeneo\Pim\Api\ListableResourceInterface;
use Akeneo\Pim\Client\ResourceClientInterface;
use Akeneo\Pim\Exception\InvalidArgumentException;
use Akeneo\Pim\Pagination\PageFactoryInterface;
use Akeneo\Pim\Pagination\PageInterface;
use Akeneo\Pim\Pagination\ResourceCursorFactoryInterface;
use Akeneo\Pim\Pagination\ResourceCursorInterface;
use Akeneo\Pim\Stream\UpsertResourceListResponse;
namespace spec\Akeneo\Pim\ApiClient\Api;

use Akeneo\Pim\ApiClient\Api\AssociationTypeApi;
use Akeneo\Pim\ApiClient\Api\AssociationTypeApiInterface;
use Akeneo\Pim\ApiClient\Api\Operation\CreatableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\GettableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\ListableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\UpsertableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\UpsertableResourceListInterface;
use Akeneo\Pim\ApiClient\Client\ResourceClientInterface;
use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException;
use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface;
use Akeneo\Pim\ApiClient\Pagination\PageInterface;
use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface;
use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface;
use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponse;
use PhpSpec\ObjectBehavior;

class AssociationTypeApiSpec extends ObjectBehavior
Expand All @@ -31,6 +34,9 @@ function it_is_initializable()
$this->shouldImplement(AssociationTypeApiInterface::class);
$this->shouldImplement(GettableResourceInterface::class);
$this->shouldImplement(ListableResourceInterface::class);
$this->shouldImplement(CreatableResourceInterface::class);
$this->shouldImplement(UpsertableResourceInterface::class);
$this->shouldImplement(UpsertableResourceListInterface::class);
}

function it_returns_an_association_type($resourceClient)
Expand Down
32 changes: 20 additions & 12 deletions spec/Api/AttributeApiSpec.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<?php

namespace spec\Akeneo\Pim\Api;

use Akeneo\Pim\Api\AttributeApi;
use Akeneo\Pim\Api\AttributeApiInterface;
use Akeneo\Pim\Api\ListableResourceInterface;
use Akeneo\Pim\Client\ResourceClientInterface;
use Akeneo\Pim\Exception\InvalidArgumentException;
use Akeneo\Pim\Pagination\PageFactoryInterface;
use Akeneo\Pim\Pagination\PageInterface;
use Akeneo\Pim\Pagination\ResourceCursorFactoryInterface;
use Akeneo\Pim\Pagination\ResourceCursorInterface;
use Akeneo\Pim\Stream\UpsertResourceListResponse;
namespace spec\Akeneo\Pim\ApiClient\Api;

use Akeneo\Pim\ApiClient\Api\AttributeApi;
use Akeneo\Pim\ApiClient\Api\AttributeApiInterface;
use Akeneo\Pim\ApiClient\Api\Operation\CreatableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\GettableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\ListableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\UpsertableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\UpsertableResourceListInterface;
use Akeneo\Pim\ApiClient\Client\ResourceClientInterface;
use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException;
use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface;
use Akeneo\Pim\ApiClient\Pagination\PageInterface;
use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface;
use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface;
use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponse;
use PhpSpec\ObjectBehavior;

class AttributeApiSpec extends ObjectBehavior
Expand All @@ -28,7 +32,11 @@ function it_is_initializable()
{
$this->shouldHaveType(AttributeApi::class);
$this->shouldImplement(AttributeApiInterface::class);
$this->shouldImplement(GettableResourceInterface::class);
$this->shouldImplement(ListableResourceInterface::class);
$this->shouldImplement(CreatableResourceInterface::class);
$this->shouldImplement(UpsertableResourceInterface::class);
$this->shouldImplement(UpsertableResourceListInterface::class);
}

function it_returns_an_attribute($resourceClient)
Expand Down
32 changes: 20 additions & 12 deletions spec/Api/AttributeGroupApiSpec.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<?php

namespace spec\Akeneo\Pim\Api;

use Akeneo\Pim\Api\AttributeGroupApi;
use Akeneo\Pim\Api\AttributeGroupApiInterface;
use Akeneo\Pim\Api\ListableResourceInterface;
use Akeneo\Pim\Client\ResourceClientInterface;
use Akeneo\Pim\Exception\InvalidArgumentException;
use Akeneo\Pim\Pagination\PageFactoryInterface;
use Akeneo\Pim\Pagination\PageInterface;
use Akeneo\Pim\Pagination\ResourceCursorFactoryInterface;
use Akeneo\Pim\Pagination\ResourceCursorInterface;
use Akeneo\Pim\Stream\UpsertResourceListResponse;
namespace spec\Akeneo\Pim\ApiClient\Api;

use Akeneo\Pim\ApiClient\Api\AttributeGroupApi;
use Akeneo\Pim\ApiClient\Api\AttributeGroupApiInterface;
use Akeneo\Pim\ApiClient\Api\Operation\CreatableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\GettableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\ListableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\UpsertableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\UpsertableResourceListInterface;
use Akeneo\Pim\ApiClient\Client\ResourceClientInterface;
use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException;
use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface;
use Akeneo\Pim\ApiClient\Pagination\PageInterface;
use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface;
use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface;
use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponse;
use PhpSpec\ObjectBehavior;

class AttributeGroupApiSpec extends ObjectBehavior
Expand All @@ -28,7 +32,11 @@ function it_is_initializable()
{
$this->shouldHaveType(AttributeGroupApi::class);
$this->shouldImplement(AttributeGroupApiInterface::class);
$this->shouldImplement(GettableResourceInterface::class);
$this->shouldImplement(ListableResourceInterface::class);
$this->shouldImplement(CreatableResourceInterface::class);
$this->shouldImplement(UpsertableResourceInterface::class);
$this->shouldImplement(UpsertableResourceListInterface::class);
}

function it_returns_an_attribute_group($resourceClient)
Expand Down
20 changes: 10 additions & 10 deletions spec/Api/AttributeOptionApiSpec.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

namespace spec\Akeneo\Pim\Api;

use Akeneo\Pim\Api\AttributeOptionApi;
use Akeneo\Pim\Api\AttributeOptionApiInterface;
use Akeneo\Pim\Client\ResourceClientInterface;
use Akeneo\Pim\Exception\InvalidArgumentException;
use Akeneo\Pim\Pagination\PageFactoryInterface;
use Akeneo\Pim\Pagination\PageInterface;
use Akeneo\Pim\Pagination\ResourceCursorFactoryInterface;
use Akeneo\Pim\Pagination\ResourceCursorInterface;
namespace spec\Akeneo\Pim\ApiClient\Api;

use Akeneo\Pim\ApiClient\Api\AttributeOptionApi;
use Akeneo\Pim\ApiClient\Api\AttributeOptionApiInterface;
use Akeneo\Pim\ApiClient\Client\ResourceClientInterface;
use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException;
use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface;
use Akeneo\Pim\ApiClient\Pagination\PageInterface;
use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface;
use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface;
use PhpSpec\ObjectBehavior;

class AttributeOptionApiSpec extends ObjectBehavior
Expand Down
10 changes: 5 additions & 5 deletions spec/Api/AuthenticationApiSpec.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace spec\Akeneo\Pim\Api;
namespace spec\Akeneo\Pim\ApiClient\Api;

use Akeneo\Pim\Api\AuthenticationApi;
use Akeneo\Pim\Api\AuthenticationApiInterface;
use Akeneo\Pim\Client\HttpClient;
use Akeneo\Pim\Routing\UriGeneratorInterface;
use Akeneo\Pim\ApiClient\Api\AuthenticationApi;
use Akeneo\Pim\ApiClient\Api\AuthenticationApiInterface;
use Akeneo\Pim\ApiClient\Client\HttpClient;
use Akeneo\Pim\ApiClient\Routing\UriGeneratorInterface;
use PhpSpec\ObjectBehavior;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
Expand Down
35 changes: 18 additions & 17 deletions spec/Api/CategoryApiSpec.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?php

namespace spec\Akeneo\Pim\Api;

use Akeneo\Pim\Api\CategoryApi;
use Akeneo\Pim\Api\CategoryApiInterface;
use Akeneo\Pim\Api\CreatableResourceInterface;
use Akeneo\Pim\Api\ListableResourceInterface;
use Akeneo\Pim\Api\UpsertableResourceInterface;
use Akeneo\Pim\Api\UpsertableResourceListInterface;
use Akeneo\Pim\Client\ResourceClientInterface;
use Akeneo\Pim\Exception\InvalidArgumentException;
use Akeneo\Pim\Pagination\PageFactoryInterface;
use Akeneo\Pim\Pagination\PageInterface;
use Akeneo\Pim\Pagination\ResourceCursorFactoryInterface;
use Akeneo\Pim\Pagination\ResourceCursorInterface;
use Akeneo\Pim\Routing\Route;
use Akeneo\Pim\Stream\UpsertResourceListResponse;
namespace spec\Akeneo\Pim\ApiClient\Api;

use Akeneo\Pim\ApiClient\Api\CategoryApi;
use Akeneo\Pim\ApiClient\Api\CategoryApiInterface;
use Akeneo\Pim\ApiClient\Api\Operation\CreatableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\GettableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\ListableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\UpsertableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\UpsertableResourceListInterface;
use Akeneo\Pim\ApiClient\Client\ResourceClientInterface;
use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException;
use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface;
use Akeneo\Pim\ApiClient\Pagination\PageInterface;
use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface;
use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface;
use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponse;
use PhpSpec\ObjectBehavior;

class CategoryApiSpec extends ObjectBehavior
Expand All @@ -31,9 +31,10 @@ function it_is_initializable()
{
$this->shouldHaveType(CategoryApi::class);
$this->shouldImplement(CategoryApiInterface::class);
$this->shouldImplement(GettableResourceInterface::class);
$this->shouldImplement(ListableResourceInterface::class);
$this->shouldImplement(UpsertableResourceInterface::class);
$this->shouldImplement(CreatableResourceInterface::class);
$this->shouldImplement(UpsertableResourceInterface::class);
$this->shouldImplement(UpsertableResourceListInterface::class);
}

Expand Down
32 changes: 20 additions & 12 deletions spec/Api/ChannelApiSpec.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<?php

namespace spec\Akeneo\Pim\Api;

use Akeneo\Pim\Api\ChannelApi;
use Akeneo\Pim\Api\ChannelApiInterface;
use Akeneo\Pim\Api\ListableResourceInterface;
use Akeneo\Pim\Client\ResourceClientInterface;
use Akeneo\Pim\Exception\InvalidArgumentException;
use Akeneo\Pim\Pagination\PageInterface;
use Akeneo\Pim\Pagination\PageFactoryInterface;
use Akeneo\Pim\Pagination\ResourceCursorFactoryInterface;
use Akeneo\Pim\Pagination\ResourceCursorInterface;
use Akeneo\Pim\Stream\UpsertResourceListResponse;
namespace spec\Akeneo\Pim\ApiClient\Api;

use Akeneo\Pim\ApiClient\Api\ChannelApi;
use Akeneo\Pim\ApiClient\Api\ChannelApiInterface;
use Akeneo\Pim\ApiClient\Api\Operation\CreatableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\GettableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\ListableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\UpsertableResourceInterface;
use Akeneo\Pim\ApiClient\Api\Operation\UpsertableResourceListInterface;
use Akeneo\Pim\ApiClient\Client\ResourceClientInterface;
use Akeneo\Pim\ApiClient\Exception\InvalidArgumentException;
use Akeneo\Pim\ApiClient\Pagination\PageFactoryInterface;
use Akeneo\Pim\ApiClient\Pagination\PageInterface;
use Akeneo\Pim\ApiClient\Pagination\ResourceCursorFactoryInterface;
use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface;
use Akeneo\Pim\ApiClient\Stream\UpsertResourceListResponse;
use PhpSpec\ObjectBehavior;

class ChannelApiSpec extends ObjectBehavior
Expand All @@ -28,7 +32,11 @@ function it_is_initializable()
{
$this->shouldHaveType(ChannelApi::class);
$this->shouldImplement(ChannelApiInterface::class);
$this->shouldImplement(GettableResourceInterface::class);
$this->shouldImplement(ListableResourceInterface::class);
$this->shouldImplement(CreatableResourceInterface::class);
$this->shouldImplement(UpsertableResourceInterface::class);
$this->shouldImplement(UpsertableResourceListInterface::class);
}

function it_returns_a_channel($resourceClient)
Expand Down
Loading