Skip to content

Commit c22bd44

Browse files
committed
Update: subscriber attribute values routes
1 parent 3c41f7e commit c22bd44

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

src/Subscription/Controller/SubscriberAttributeValueController.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
use Symfony\Component\HttpFoundation\Response;
2323
use Symfony\Component\Routing\Attribute\Route;
2424

25-
#[Route('/subscribers/attribute-values', name: 'subscriber_attribute_value_')]
25+
#[Route('/subscribers', name: 'subscriber_attribute_value_')]
2626
class SubscriberAttributeValueController extends BaseController
2727
{
2828
private SubscriberAttributeManager $attributeManager;
@@ -44,16 +44,16 @@ public function __construct(
4444
}
4545

4646
#[Route(
47-
path: '/{subscriberId}/{definitionId}',
47+
path: '/{subscriberId}/attributes/{definitionId}',
4848
name: 'create',
4949
requirements: ['subscriberId' => '\d+', 'definitionId' => '\d+'],
5050
methods: ['POST', 'PUT']
5151
)]
5252
#[OA\Post(
53-
path: '/api/v2/subscribers/attribute-values/{subscriberId}/{definitionId}',
53+
path: '/api/v2/subscribers/{subscriberId}/attributes/{definitionId}',
5454
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
5555
'Returns created/updated subscriber attribute.',
56-
summary: 'Create/update a subscriber attribute.',
56+
summary: 'Create/update a subscriber attribute value.',
5757
requestBody: new OA\RequestBody(
5858
description: 'Pass parameters to create subscriber attribute.',
5959
required: true,
@@ -130,13 +130,13 @@ public function createOrUpdate(
130130
}
131131

132132
#[Route(
133-
path: '/{subscriberId}/{definitionId}',
133+
path: '/{subscriberId}/attributes/{definitionId}',
134134
name: 'delete',
135135
requirements: ['subscriberId' => '\d+', 'definitionId' => '\d+'],
136136
methods: ['DELETE']
137137
)]
138138
#[OA\Delete(
139-
path: '/api/v2/subscribers/attribute-values/{subscriberId}/{definitionId}',
139+
path: '/api/v2/subscribers/{subscriberId}/attributes/{definitionId}',
140140
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
141141
'Deletes a single subscriber attribute.',
142142
summary: 'Deletes an attribute.',
@@ -200,9 +200,9 @@ public function delete(
200200
return $this->json(null, Response::HTTP_NO_CONTENT);
201201
}
202202

203-
#[Route('/{subscriberId}', name: 'get_list', requirements: ['subscriberId' => '\d+'], methods: ['GET'])]
203+
#[Route('/{subscriberId}/attributes', name: 'get_list', requirements: ['subscriberId' => '\d+'], methods: ['GET'])]
204204
#[OA\Get(
205-
path: '/api/v2/subscribers/attribute-values/{subscriberId}',
205+
path: '/api/v2/subscribers/{subscriberId}/attributes',
206206
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
207207
'Returns a JSON list of all subscriber attributes.',
208208
summary: 'Gets a list of all subscriber attributes.',
@@ -270,23 +270,23 @@ public function getPaginated(
270270

271271
return $this->json(
272272
$this->paginatedDataProvider->getPaginatedList(
273-
$request,
274-
$this->normalizer,
275-
SubscriberAttributeValue::class,
276-
$filter
273+
request: $request,
274+
normalizer: $this->normalizer,
275+
className: SubscriberAttributeValue::class,
276+
filter: $filter
277277
),
278278
Response::HTTP_OK
279279
);
280280
}
281281

282282
#[Route(
283-
path: '/{subscriberId}/{definitionId}',
283+
path: '/{subscriberId}/attributes/{definitionId}',
284284
name: 'get_one',
285285
requirements: ['subscriberId' => '\d+', 'definitionId' => '\d+'],
286286
methods: ['GET']
287287
)]
288288
#[OA\Get(
289-
path: '/api/v2/subscribers/attribute-values/{subscriberId}/{definitionId}',
289+
path: '/api/v2/subscribers/{subscriberId}/attributes/{definitionId}',
290290
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
291291
'Returns a single attribute.',
292292
summary: 'Gets subscriber attribute.',

tests/Integration/Subscription/Controller/SubscriberAttributeValueControllerTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
class SubscriberAttributeValueControllerTest extends AbstractTestController
1414
{
15-
1615
public function testControllerIsAvailableViaContainer(): void
1716
{
1817
self::assertInstanceOf(
@@ -34,7 +33,7 @@ public function testCreateOrUpdateAttributeValue(): void
3433

3534
$this->authenticatedJsonRequest(
3635
'post',
37-
'/api/v2/subscribers/attribute-values/' . $subscriberId . '/' . $definitionId,
36+
'/api/v2/subscribers/' . $subscriberId . '/attributes/' . $definitionId,
3837
[],
3938
[],
4039
[],
@@ -55,7 +54,7 @@ public function testDeleteAttributeValue(): void
5554

5655
$this->authenticatedJsonRequest(
5756
'delete',
58-
'/api/v2/subscribers/attribute-values/1/1'
57+
'/api/v2/subscribers/1/attributes/1'
5958
);
6059

6160
$this->assertHttpNoContent();
@@ -70,7 +69,7 @@ public function testGetPaginatedAttributes(): void
7069

7170
$this->authenticatedJsonRequest(
7271
'get',
73-
'/api/v2/subscribers/attribute-values/1'
72+
'/api/v2/subscribers/1/attributes'
7473
);
7574

7675
$this->assertHttpOkay();
@@ -83,7 +82,7 @@ public function testAttributeValueNotFoundReturns404(): void
8382
{
8483
$this->authenticatedJsonRequest(
8584
'get',
86-
'/api/v2/subscribers/attribute-values/999/999'
85+
'/api/v2/subscribers/999/attributes/999'
8786
);
8887

8988
$this->assertHttpNotFound();

0 commit comments

Comments
 (0)