diff --git a/composer.json b/composer.json index 81112ad0..ae6cf62b 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "PHP binding for v4 of the Cloudflare Client API.", "type": "library", "require": { - "guzzlehttp/guzzle": "^7.0.1", + "guzzlehttp/guzzle": "^7.2.0", "php": ">=7.2.5", "psr/http-message": "~1.0", "ext-json": "*" diff --git a/src/Endpoints/DNS.php b/src/Endpoints/DNS.php index a9f74749..bc7488d3 100644 --- a/src/Endpoints/DNS.php +++ b/src/Endpoints/DNS.php @@ -153,4 +153,40 @@ public function deleteRecord(string $zoneID, string $recordID): bool return false; } + + + /** + * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * + * @param string $zoneID + * @param array $deletes + * @param array $patches + * @param array $posts + * @param array $puts + * @param bool $proxied + * @param string $priority + * @param array $data + * @return bool + */ + public function batchRecords( + string $zoneID, + array $deletes = [], + array $patches = [], + array $posts = [], + array $puts = [] + ): bool { + $options = [ + 'deletes' => $deletes, + 'patches' => $patches, + 'posts' => $posts, + 'puts' => $puts, + ]; + + + $user = $this->adapter->post('zones/' . $zoneID . '/dns_records/batch', $options); + + return $user->getStatusCode() === 200; + + } + }