|
10 | 10 | use PhpList\RestBundle\Controller\Traits\AuthenticationTrait; |
11 | 11 | use PhpList\RestBundle\Entity\Request\CreateSubscriberListRequest; |
12 | 12 | use PhpList\RestBundle\Serializer\SubscriberListNormalizer; |
13 | | -use PhpList\RestBundle\Serializer\SubscriberNormalizer; |
14 | 13 | use PhpList\RestBundle\Service\Manager\SubscriberListManager; |
15 | 14 | use PhpList\RestBundle\Validator\RequestValidator; |
16 | 15 | use Symfony\Bridge\Doctrine\Attribute\MapEntity; |
@@ -243,115 +242,6 @@ public function deleteList( |
243 | 242 | return new JsonResponse(null, Response::HTTP_NO_CONTENT); |
244 | 243 | } |
245 | 244 |
|
246 | | - #[Route('/{listId}/subscribers', name: 'get_subscriber_from_list', methods: ['GET'])] |
247 | | - #[OA\Get( |
248 | | - path: '/lists/{listId}/subscribers', |
249 | | - description: 'Returns a JSON list of all subscribers for a subscriber list.', |
250 | | - summary: 'Gets a list of all subscribers of a subscriber list.', |
251 | | - tags: ['lists'], |
252 | | - parameters: [ |
253 | | - new OA\Parameter( |
254 | | - name: 'session', |
255 | | - description: 'Session ID obtained from authentication', |
256 | | - in: 'header', |
257 | | - required: true, |
258 | | - schema: new OA\Schema(type: 'string') |
259 | | - ), |
260 | | - new OA\Parameter( |
261 | | - name: 'listId', |
262 | | - description: 'List ID', |
263 | | - in: 'path', |
264 | | - required: true, |
265 | | - schema: new OA\Schema(type: 'string') |
266 | | - ) |
267 | | - ], |
268 | | - responses: [ |
269 | | - new OA\Response( |
270 | | - response: 200, |
271 | | - description: 'Success', |
272 | | - content: new OA\JsonContent( |
273 | | - type: 'array', |
274 | | - items: new OA\Items(ref: '#/components/schemas/Subscriber') |
275 | | - ) |
276 | | - ), |
277 | | - new OA\Response( |
278 | | - response: 403, |
279 | | - description: 'Failure', |
280 | | - content: new OA\JsonContent(ref: '#/components/schemas/UnauthorizedResponse') |
281 | | - ) |
282 | | - ] |
283 | | - )] |
284 | | - public function getListMembers( |
285 | | - Request $request, |
286 | | - #[MapEntity(mapping: ['listId' => 'id'])] SubscriberList $list, |
287 | | - SubscriberNormalizer $normalizer |
288 | | - ): JsonResponse { |
289 | | - $this->requireAuthentication($request); |
290 | | - |
291 | | - $subscribers = $this->subscriberListManager->getSubscriberListMembers($list); |
292 | | - $normalized = array_map(function ($item) use ($normalizer) { |
293 | | - return $normalizer->normalize($item); |
294 | | - }, $subscribers); |
295 | | - |
296 | | - return new JsonResponse($normalized, Response::HTTP_OK); |
297 | | - } |
298 | | - |
299 | | - #[Route('/{listId}/subscribers/count', name: 'get_subscribers_count_from_list', methods: ['GET'])] |
300 | | - #[OA\Get( |
301 | | - path: '/lists/{listId}/count', |
302 | | - description: 'Returns a count of all subscribers in a given list.', |
303 | | - summary: 'Gets the total number of subscribers of a list', |
304 | | - tags: ['lists'], |
305 | | - parameters: [ |
306 | | - new OA\Parameter( |
307 | | - name: 'session', |
308 | | - description: 'Session ID obtained from authentication', |
309 | | - in: 'header', |
310 | | - required: true, |
311 | | - schema: new OA\Schema(type: 'string') |
312 | | - ), |
313 | | - new OA\Parameter( |
314 | | - name: 'listId', |
315 | | - description: 'List ID', |
316 | | - in: 'path', |
317 | | - required: true, |
318 | | - schema: new OA\Schema(type: 'string') |
319 | | - ) |
320 | | - ], |
321 | | - responses: [ |
322 | | - new OA\Response( |
323 | | - response: 200, |
324 | | - description: 'Success', |
325 | | - content: new OA\JsonContent( |
326 | | - properties: [ |
327 | | - new OA\Property( |
328 | | - property: 'subscribers_count', |
329 | | - type: 'integer', |
330 | | - example: 42 |
331 | | - ) |
332 | | - ], |
333 | | - type: 'object' |
334 | | - ) |
335 | | - ), |
336 | | - new OA\Response( |
337 | | - response: 403, |
338 | | - description: 'Failure', |
339 | | - content: new OA\JsonContent(ref: '#/components/schemas/UnauthorizedResponse') |
340 | | - ) |
341 | | - ] |
342 | | - )] |
343 | | - public function getSubscribersCount( |
344 | | - Request $request, |
345 | | - #[MapEntity(mapping: ['listId' => 'id'])] SubscriberList $list |
346 | | - ): JsonResponse { |
347 | | - $this->requireAuthentication($request); |
348 | | - |
349 | | - return new JsonResponse( |
350 | | - ['subscribers_count' => count($list->getSubscribers())], |
351 | | - Response::HTTP_OK, |
352 | | - ); |
353 | | - } |
354 | | - |
355 | 245 | #[Route('', name: 'create_list', methods: ['POST'])] |
356 | 246 | #[OA\Post( |
357 | 247 | path: '/lists', |
|
0 commit comments