From b8a386b4988da2fc54499d914b42544e709e0807 Mon Sep 17 00:00:00 2001 From: David Kalianko Date: Wed, 16 Oct 2024 10:28:51 +0200 Subject: [PATCH 1/2] Add `BatchSendingsEndpoint.send` endpoint --- CHANGELOG.md | 3 +++ src/Endpoint/BatchSendingsEndpoint.php | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc903ae..379ccac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes will be documented in this file. Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles. +## [Unreleased] +- Add `BatchSendingsEndpoint.send` endpoint + ## [2.5.0] - 2024-10-14 - Add `AccountBilling.automaticTagsPlacement` - Add `AccountBilling.batchSending` diff --git a/src/Endpoint/BatchSendingsEndpoint.php b/src/Endpoint/BatchSendingsEndpoint.php index 7f8ff61..8e6db75 100644 --- a/src/Endpoint/BatchSendingsEndpoint.php +++ b/src/Endpoint/BatchSendingsEndpoint.php @@ -9,6 +9,7 @@ use DigitalCz\DigiSign\Endpoint\Traits\DeleteEndpointTrait; use DigitalCz\DigiSign\Endpoint\Traits\GetEndpointTrait; use DigitalCz\DigiSign\Endpoint\Traits\UpdateEndpointTrait; +use DigitalCz\DigiSign\Resource\BaseResource; use DigitalCz\DigiSign\Resource\BatchSending; /** @@ -34,4 +35,9 @@ public function items(BatchSending|string $id): BatchSendingItemsEndpoint { return new BatchSendingItemsEndpoint($this, $id); } + + public function send(BatchSending|string $id): BaseResource + { + return $this->makeResource($this->postRequest('/{id}/send', ['id' => $id])); + } } From 14013fc0618745523f1e3b5d691426e395aef00f Mon Sep 17 00:00:00 2001 From: David Kalianko Date: Wed, 16 Oct 2024 10:39:02 +0200 Subject: [PATCH 2/2] Add Tests --- tests/Endpoint/BatchSendingEndpointTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/Endpoint/BatchSendingEndpointTest.php b/tests/Endpoint/BatchSendingEndpointTest.php index 6e98b8c..74dddeb 100644 --- a/tests/Endpoint/BatchSendingEndpointTest.php +++ b/tests/Endpoint/BatchSendingEndpointTest.php @@ -29,6 +29,12 @@ public function testCRUD(): void self::assertLastRequest('DELETE', "/api/batch-sendings/foo"); } + public function testSend(): void + { + self::endpoint()->send('foo'); + self::assertLastRequest('POST', "/api/batch-sendings/foo/send"); + } + protected static function endpoint(): BatchSendingsEndpoint { return self::dgs()->batchSendings();