Skip to content

Commit

Permalink
Remove Admin API references
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Feb 26, 2024
1 parent fe9fa3f commit dfbed82
Show file tree
Hide file tree
Showing 17 changed files with 1 addition and 307 deletions.
74 changes: 0 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,80 +270,6 @@ To run test application to play with just type `composer try`.
admin form like you usually do with `Product` form via
`sylius.menu.admin.product.form` event.

## Testing

### Play with API

* Install https://stedolan.github.io/jq/
(type `brew install jq` at OSX terminal)

* Get admin API access token:

```bash
SYLIUS_ADMIN_API_ACCESS_TOKEN=$(curl http://localhost:8000/api/oauth/v2/token \
--silent --show-error \
-d "client_id"=demo_client \
-d "client_secret"=secret_demo_client \
-d "grant_type"=password \
-d "username"[email protected] \
-d "password"=sylius-api | jq '.access_token' --raw-output)
```

* Make requests:

(`GET` requests indexing/showing resources shown here as an example,
see `tests/Controller/*ApiTest.php` to discover more details
about creating/updating/removing brand-related resources,
creating new products with brand attached to it,
uploading image files for `BrandImages` via API)

To Brands admin API:

```bash
curl http://localhost:8000/api/v1/brands/ \
-H "Authorization: Bearer $SYLIUS_ADMIN_API_ACCESS_TOKEN"
```

```bash
curl http://localhost:8000/api/v1/brands/setono/ \
-H "Authorization: Bearer $SYLIUS_ADMIN_API_ACCESS_TOKEN"
```

Brand images API:

```bash
curl http://localhost:8000/api/v1/brands/setono/images/ \
-H "Authorization: Bearer $SYLIUS_ADMIN_API_ACCESS_TOKEN"
```

Brand images by type API:

```bash
curl http://localhost:8000/api/v1/brands/setono/images/logo/ \
-H "Authorization: Bearer $SYLIUS_ADMIN_API_ACCESS_TOKEN"
```

```bash
curl http://localhost:8000/api/v1/brands/setono/images/<ID>/ \
-H "Authorization: Bearer $SYLIUS_ADMIN_API_ACCESS_TOKEN"
```

Brand products API:

```bash
curl http://localhost:8000/api/v1/brands/setono/products/ \
-H "Authorization: Bearer $SYLIUS_ADMIN_API_ACCESS_TOKEN"
```

Product details API:

```bash
curl http://localhost:8000/api/v1/products/setono-mug/ \
-H "Authorization: Bearer $SYLIUS_ADMIN_API_ACCESS_TOKEN"
```

For XML output, add `-H "Accept: application/xml"` to request

## Contribute

Please, run `composer all` to run all checks and tests before committing.
Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"fakerphp/faker": "^1.23",
"knplabs/knp-menu": "^3.4",
"psr/event-dispatcher": "^1.0",
"sylius/admin-api-bundle": "^1.0",
"sylius/admin-bundle": "^1.0",
"sylius/core": "^1.0",
"sylius/core-bundle": "^1.0",
Expand Down
7 changes: 0 additions & 7 deletions src/Form/Extension/Api/ProductTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
namespace Loevgaard\SyliusBrandPlugin\Form\Extension\Api;

use Loevgaard\SyliusBrandPlugin\Form\Type\BrandChoiceType;
use Sylius\Bundle\AdminApiBundle\Form\Type\ProductType;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormBuilderInterface;

class ProductTypeExtension extends AbstractTypeExtension
{
/**
* @inheritdoc
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('brand', BrandChoiceType::class, [
Expand All @@ -23,9 +19,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
]);
}

/**
* @inheritdoc
*/
public static function getExtendedTypes(): iterable
{
return [
Expand Down
9 changes: 0 additions & 9 deletions src/Resources/config/app/config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,2 @@
imports:
- "@LoevgaardSyliusBrandPlugin/Resources/config/grids/loevgaard_sylius_brand_admin_api_brand.yaml"
- "@LoevgaardSyliusBrandPlugin/Resources/config/grids/loevgaard_sylius_brand_admin_api_brand_image.yaml"
- "@LoevgaardSyliusBrandPlugin/Resources/config/grids/loevgaard_sylius_brand_admin_brand.yaml"

jms_serializer:
metadata:
directories:
loevgaard-sylius-brand:
namespace_prefix: "Loevgaard\\SyliusBrandPlugin\\Model"
path: "@LoevgaardSyliusBrandPlugin/Resources/config/serializer"

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions src/Resources/config/routing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ loevgaard_sylius_brand_shop:
loevgaard_sylius_brand_admin:
resource: "@LoevgaardSyliusBrandPlugin/Resources/config/routing/admin.yaml"
prefix: /admin

loevgaard_sylius_brand_admin_api:
resource: "@LoevgaardSyliusBrandPlugin/Resources/config/routing/admin_api.yaml"
prefix: /api/v{version}
36 changes: 0 additions & 36 deletions src/Resources/config/routing/admin_api.yaml

This file was deleted.

49 changes: 0 additions & 49 deletions src/Resources/config/routing/admin_api/brand_image.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions src/Resources/config/routing_non_localized.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,3 @@ loevgaard_sylius_brand_shop:
loevgaard_sylius_brand_admin:
resource: "@LoevgaardSyliusBrandPlugin/Resources/config/routing/admin.yaml"
prefix: /admin

loevgaard_sylius_brand_admin_api:
resource: "@LoevgaardSyliusBrandPlugin/Resources/config/routing/admin_api.yaml"
prefix: /api/v{version}
40 changes: 0 additions & 40 deletions src/Resources/config/serializer/Brand.yml

This file was deleted.

11 changes: 0 additions & 11 deletions src/Resources/config/serializer/BrandImage.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/Resources/config/services/form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class="Loevgaard\SyliusBrandPlugin\Form\Extension\Api\ProductTypeExtension">
<argument>%loevgaard_sylius_brand.model.brand.class%</argument>

<tag name="form.type_extension" extended_type="Sylius\Bundle\AdminApiBundle\Form\Type\ProductType"/>
<tag name="form.type_extension"/>
</service>

<service id="loevgaard_sylius_brand.form.type.brand_choice"
Expand Down
1 change: 0 additions & 1 deletion tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true],
Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true],
FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true],
Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true],
Expand Down
3 changes: 0 additions & 3 deletions tests/Application/config/packages/_sylius.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
imports:
- { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" }
- { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusShopBundle/Resources/config/app/config.yml" }

parameters:
Expand Down
3 changes: 0 additions & 3 deletions tests/Application/config/routes/sylius_admin_api.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions tests/DataFixtures/ORM/authentication/api_administrator.yml

This file was deleted.

0 comments on commit dfbed82

Please sign in to comment.