浏览代码

Article things.

Shane Mc Cormack 6 年之前
父节点
当前提交
92d5d03f8d
共有 1 个文件被更改,包括 62 次插入0 次删除
  1. 62 0
      src/MyDNSHostAPI.php

+ 62 - 0
src/MyDNSHostAPI.php

@@ -1000,6 +1000,68 @@
 			return isset($result['response']) ? $result['response'] : [];
 			return isset($result['response']) ? $result['response'] : [];
 		}
 		}
 
 
+		/**
+		 * Get all articles.
+		 *
+		 * @return Result from the API.
+		 */
+		public function getAllArticles() {
+			if ($this->auth === FALSE) { return []; }
+
+			$result = $this->api('/admin/articles');
+			return isset($result['response']) ? $result['response'] : [];
+		}
+
+		/**
+		 * Crate a new article.
+		 *
+		 * @param $data Data for create
+		 * @return Result from the API.
+		 */
+		public function createArticle($data) {
+			if ($this->auth === FALSE) { return []; }
+
+			return $this->api('/admin/articles', 'POST', $data);
+		}
+
+		/**
+		 * Get a specific article.
+		 *
+		 * @param $articleid Article to get
+		 * @return Result from the API.
+		 */
+		public function getArticle($articleid) {
+			if ($this->auth === FALSE) { return []; }
+
+			$result = $this->api('/admin/articles/' . $articleid);
+			return isset($result['response']) ? $result['response'] : [];
+		}
+
+		/**
+		 * Update a specific article.
+		 *
+		 * @param $articleid Article to update
+		 * @param $data Data for update
+		 * @return Result from the API.
+		 */
+		public function updateArticle($articleid) {
+			if ($this->auth === FALSE) { return []; }
+
+			return $this->api('/admin/articles/' . $articleid, 'POST', $data);
+		}
+
+		/**
+		 * Delete a specific article.
+		 *
+		 * @param $articleid Article to delete
+		 * @return Result from the API.
+		 */
+		public function deleteArticle($articleid) {
+			if ($this->auth === FALSE) { return []; }
+
+			return $this->api('/admin/articles/' . $articleid, 'DELETE');
+		}
+
 		/**
 		/**
 		 * Get the last response from the API
 		 * Get the last response from the API
 		 *
 		 *