From 2b11baff9f1aad98c6422d9ec2785788eea30d02 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Mon, 9 Apr 2018 23:16:53 +0200 Subject: [PATCH] Add a getRecordID method --- src/Endpoints/DNS.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Endpoints/DNS.php b/src/Endpoints/DNS.php index a8aad754..24aaedfc 100644 --- a/src/Endpoints/DNS.php +++ b/src/Endpoints/DNS.php @@ -108,6 +108,15 @@ public function listRecords( return (object)['result' => $body->result, 'result_info' => $body->result_info]; } + + public function getRecordID(string $zoneID, string $type = '', string $name = ''): string + { + $records = $this->listRecords($zoneID, $type, $name); + if (count($records->result) < 1) { + throw new EndpointException('Could not find records with specified name.'); + } + return $records->result[0]->id; + } public function getRecordDetails(string $zoneID, string $recordID): \stdClass {