From c76602f5de660245bc6c0db7134e0a6f9d12322c Mon Sep 17 00:00:00 2001
From: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
Date: Mon, 13 Jun 2016 11:55:40 +0100
Subject: [PATCH] Document a bunch more stuff

---
 build/index.php             | 54 ++++++++++++++++++++++++++++++++++---
 core.php                    |  8 ++++--
 module_index.json           |  8 +++---
 modules/feature-upload.php  | 19 +++++++++++--
 modules/page-credits.php    |  6 +++++
 modules/page-debug-info.php |  8 ++++++
 modules/page-delete.php     | 13 +++++++++
 7 files changed, 104 insertions(+), 12 deletions(-)

diff --git a/build/index.php b/build/index.php
index 23b6e31..fa78690 100644
--- a/build/index.php
+++ b/build/index.php
@@ -164,9 +164,13 @@ if($env->is_logged_in)
 * @apiDefine Anonymous	Anybody may use this call.
 */
 /**
- * @apiDefine UserNotLoggedInError
- * @apiError	UserNotLoggedIn	You didn't log in before sending this request.
+ * @apiDefine	UserNotLoggedInError
+ * @apiError	UserNotLoggedInError	You didn't log in before sending this request.
  */
+ /**
+  * @apiDefine	UserNotModeratorError
+  * @apiError	UserNotModeratorError	You weren't loggged in as a moderator before sending this request.
+  */
 
 
 ////////////////////
@@ -2407,8 +2411,10 @@ register_module([
 		 * @apiName UploadFile
 		 * @apiGroup Upload
 		 * @apiPermission User
-		 *
-		 * @apiParam {file} file		The file to upload.
+		 * 
+		 * @apiParam {string}	name		The name of the file to upload.
+		 * @apiParam {string}	description	A description of the file.
+		 * @apiParam {file}		file		The file to upload.
 		 *
 		 * @apiUse	UserNotLoggedInError
 		 * @apiError	UploadsDisabledError	Uploads are currently disabled in the wiki's settings.
@@ -2591,6 +2597,19 @@ register_module([
 			}
 		});
 		
+		/**
+		 * @api {get} ?action=preview Get a preview of a file
+		 * @apiName PreviewFile
+		 * @apiGroup Upload
+		 * @apiPermission Anonymous
+		 * 
+		 * @apiParam {string}	page		The name of the file to preview.
+		 * @apiParam {number}	size		Optional. The size fo the resulting preview. Will be clamped to fit within the bounds specified in the wiki's settings. May also be set to the keyword 'original', which will cause the original file to be returned with it's appropriate mime type instead.
+		 *
+		 * @apiError	PreviewNoFileError	No file was found associated with the specified page.
+		 * @apiError	PreviewUnknownFileTypeError	Pepperminty Wiki was unable to generate a preview for the requested file's type.
+		 */
+		
 		/*
 		 * ██████  ██████  ███████ ██    ██ ██ ███████ ██     ██ 
 		 * ██   ██ ██   ██ ██      ██    ██ ██ ██      ██     ██ 
@@ -2936,6 +2955,12 @@ register_module([
 	"description" => "Adds the credits page. You *must* have this module :D",
 	"id" => "page-credits",
 	"code" => function() {
+		/**
+		 * @api {get} ?action=credits Get the credits page
+		 * @apiName Credits
+		 * @apiGroup Utility
+		 * @apiPermission Anonymous
+		 */
 		
 		/*
 		 *  ██████ ██████  ███████ ██████  ██ ████████ ███████ 
@@ -3054,6 +3079,14 @@ register_module([
 	"id" => "page-debug-info",
 	"code" => function() {
 		global $settings, $env;
+		/**
+		 * @api {get} ?action=debug	Get a debug dump
+		 * @apiName Debug
+		 * @apiGroup Utility
+		 * @apiPermission Moderator
+		 *
+		 * @apiUse UserNotModeratorError
+		 */
 		
 		/*
 		 * ██████  ███████ ██████  ██    ██  ██████  
@@ -3123,6 +3156,19 @@ register_module([
 	"id" => "page-delete",
 	"code" => function() {
 		global $settings;
+		/**
+		 * @api {post} ?action=upload Delete a file
+		 * @apiDescription	Delete a page and all its associated data.
+		 * @apiName DeletePage
+		 * @apiGroup Page
+		 * @apiPermission Moderator
+		 * 
+		 * @apiParam {string}	page		The name of the page to delete.
+		 * @apiParam {string}	delete		Set to 'yes' to actually delete the page.
+		 *
+		 * @apiUse	UserNotModeratorError
+		 * @apiError	PageNonExistentError	The specified page doesn't exist
+		 */
 		
 		/*
 		 * ██████  ███████ ██      ███████ ████████ ███████ 
diff --git a/core.php b/core.php
index f61e964..0eb0530 100644
--- a/core.php
+++ b/core.php
@@ -97,9 +97,13 @@ if($env->is_logged_in)
 * @apiDefine Anonymous	Anybody may use this call.
 */
 /**
- * @apiDefine UserNotLoggedInError
- * @apiError	UserNotLoggedIn	You didn't log in before sending this request.
+ * @apiDefine	UserNotLoggedInError
+ * @apiError	UserNotLoggedInError	You didn't log in before sending this request.
  */
+ /**
+  * @apiDefine	UserNotModeratorError
+  * @apiError	UserNotModeratorError	You weren't loggged in as a moderator before sending this request.
+  */
 
 
 ////////////////////
diff --git a/module_index.json b/module_index.json
index 6dc9be4..c6166d2 100644
--- a/module_index.json
+++ b/module_index.json
@@ -77,7 +77,7 @@
         "author": "Starbeamrainbowlabs",
         "description": "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File\/' prefix.",
         "id": "feature-upload",
-        "lastupdate": 1465761892,
+        "lastupdate": 1465814688,
         "optional": false
     },
     {
@@ -86,7 +86,7 @@
         "author": "Starbeamrainbowlabs",
         "description": "Adds the credits page. You *must* have this module :D",
         "id": "page-credits",
-        "lastupdate": 1460285448,
+        "lastupdate": 1465815023,
         "optional": false
     },
     {
@@ -95,7 +95,7 @@
         "author": "Starbeamrainbowlabs",
         "description": "Adds a debug action for administrator use only that collects a load of useful information to make reporting bugs easier.",
         "id": "page-debug-info",
-        "lastupdate": 1453562632,
+        "lastupdate": 1465815112,
         "optional": false
     },
     {
@@ -104,7 +104,7 @@
         "author": "Starbeamrainbowlabs",
         "description": "Adds an action to allow administrators to delete pages.",
         "id": "page-delete",
-        "lastupdate": 1465136119,
+        "lastupdate": 1465815312,
         "optional": false
     },
     {
diff --git a/modules/feature-upload.php b/modules/feature-upload.php
index 88d6e87..8bd4d03 100644
--- a/modules/feature-upload.php
+++ b/modules/feature-upload.php
@@ -18,8 +18,10 @@ register_module([
 		 * @apiName UploadFile
 		 * @apiGroup Upload
 		 * @apiPermission User
-		 *
-		 * @apiParam {file} file		The file to upload.
+		 * 
+		 * @apiParam {string}	name		The name of the file to upload.
+		 * @apiParam {string}	description	A description of the file.
+		 * @apiParam {file}		file		The file to upload.
 		 *
 		 * @apiUse	UserNotLoggedInError
 		 * @apiError	UploadsDisabledError	Uploads are currently disabled in the wiki's settings.
@@ -202,6 +204,19 @@ register_module([
 			}
 		});
 		
+		/**
+		 * @api {get} ?action=preview Get a preview of a file
+		 * @apiName PreviewFile
+		 * @apiGroup Upload
+		 * @apiPermission Anonymous
+		 * 
+		 * @apiParam {string}	page		The name of the file to preview.
+		 * @apiParam {number}	size		Optional. The size fo the resulting preview. Will be clamped to fit within the bounds specified in the wiki's settings. May also be set to the keyword 'original', which will cause the original file to be returned with it's appropriate mime type instead.
+		 *
+		 * @apiError	PreviewNoFileError	No file was found associated with the specified page.
+		 * @apiError	PreviewUnknownFileTypeError	Pepperminty Wiki was unable to generate a preview for the requested file's type.
+		 */
+		
 		/*
 		 * ██████  ██████  ███████ ██    ██ ██ ███████ ██     ██ 
 		 * ██   ██ ██   ██ ██      ██    ██ ██ ██      ██     ██ 
diff --git a/modules/page-credits.php b/modules/page-credits.php
index 60f34eb..9f78b68 100644
--- a/modules/page-credits.php
+++ b/modules/page-credits.php
@@ -6,6 +6,12 @@ register_module([
 	"description" => "Adds the credits page. You *must* have this module :D",
 	"id" => "page-credits",
 	"code" => function() {
+		/**
+		 * @api {get} ?action=credits Get the credits page
+		 * @apiName Credits
+		 * @apiGroup Utility
+		 * @apiPermission Anonymous
+		 */
 		
 		/*
 		 *  ██████ ██████  ███████ ██████  ██ ████████ ███████ 
diff --git a/modules/page-debug-info.php b/modules/page-debug-info.php
index d0b0ae2..923e93f 100644
--- a/modules/page-debug-info.php
+++ b/modules/page-debug-info.php
@@ -7,6 +7,14 @@ register_module([
 	"id" => "page-debug-info",
 	"code" => function() {
 		global $settings, $env;
+		/**
+		 * @api {get} ?action=debug	Get a debug dump
+		 * @apiName Debug
+		 * @apiGroup Utility
+		 * @apiPermission Moderator
+		 *
+		 * @apiUse UserNotModeratorError
+		 */
 		
 		/*
 		 * ██████  ███████ ██████  ██    ██  ██████  
diff --git a/modules/page-delete.php b/modules/page-delete.php
index f00f72a..11c4a05 100644
--- a/modules/page-delete.php
+++ b/modules/page-delete.php
@@ -7,6 +7,19 @@ register_module([
 	"id" => "page-delete",
 	"code" => function() {
 		global $settings;
+		/**
+		 * @api {post} ?action=upload Delete a file
+		 * @apiDescription	Delete a page and all its associated data.
+		 * @apiName DeletePage
+		 * @apiGroup Page
+		 * @apiPermission Moderator
+		 * 
+		 * @apiParam {string}	page		The name of the page to delete.
+		 * @apiParam {string}	delete		Set to 'yes' to actually delete the page.
+		 *
+		 * @apiUse	UserNotModeratorError
+		 * @apiError	PageNonExistentError	The specified page doesn't exist
+		 */
 		
 		/*
 		 * ██████  ███████ ██      ███████ ████████ ███████ 
