瀏覽代碼

Add CRUD for BlockRegexes.

Shane Mc Cormack 4 年之前
父節點
當前提交
203c6b01bb
共有 1 個文件被更改,包括 73 次插入0 次删除
  1. 73 0
      src/MyDNSHostAPI.php

+ 73 - 0
src/MyDNSHostAPI.php

@@ -1112,6 +1112,79 @@
 			return $this->api('/admin/articles/' . $articleid, 'DELETE');
 		}
 
+		/**
+		 * Get blockregexes.
+		 *
+		 * @return Result from the API.
+		 */
+		public function getBlockRegexes() {
+			$result = $this->api('/blockregexes');
+			return isset($result['response']) ? $result['response'] : [];
+		}
+
+		/**
+		 * Get all blockregexes.
+		 *
+		 * @return Result from the API.
+		 */
+		public function getAllBlockRegexes() {
+			if ($this->auth === FALSE) { return []; }
+
+			$result = $this->api('/admin/blockregexes');
+			return isset($result['response']) ? $result['response'] : [];
+		}
+
+		/**
+		 * Crate a new blockregex.
+		 *
+		 * @param $data Data for create
+		 * @return Result from the API.
+		 */
+		public function createBlockRegex($data) {
+			if ($this->auth === FALSE) { return []; }
+
+			return $this->api('/admin/blockregexes', 'POST', $data);
+		}
+
+		/**
+		 * Get a specific blockregex.
+		 *
+		 * @param $blockregexid BlockRegex to get
+		 * @return Result from the API.
+		 */
+		public function getBlockRegex($blockregexid) {
+			if ($this->auth === FALSE) { return []; }
+
+			$result = $this->api('/admin/blockregexes/' . $blockregexid);
+			return isset($result['response']) ? $result['response'] : [];
+		}
+
+		/**
+		 * Update a specific blockregex.
+		 *
+		 * @param $blockregexid BlockRegex to update
+		 * @param $data Data for update
+		 * @return Result from the API.
+		 */
+		public function updateBlockRegex($blockregexid, $data) {
+			if ($this->auth === FALSE) { return []; }
+
+			return $this->api('/admin/blockregexes/' . $blockregexid, 'POST', $data);
+		}
+
+		/**
+		 * Delete a specific blockregex.
+		 *
+		 * @param $blockregexid BlockRegex to delete
+		 * @return Result from the API.
+		 */
+		public function deleteBlockRegex($blockregexid) {
+			if ($this->auth === FALSE) { return []; }
+
+			return $this->api('/admin/blockregexes/' . $blockregexid, 'DELETE');
+		}
+
+
 		/**
 		 * Get the last response from the API
 		 *