Update API documentation

This commit is contained in:
Ivan Diaz 2018-09-20 17:19:47 -03:00
parent 285b62832a
commit b4342167e4
95 changed files with 148 additions and 184 deletions

View File

@ -56,6 +56,7 @@ Just as there is a `gulp dev` task for development, there is also a `gulp prod`
- `make db` access to mysql database console
- `make sh` access to backend docker container bash
- `make test` run phpunit tests
- `make doc` to build the documentation (requires `apidoc`)
Server api runs on `http://localhost:8080/`
Also, there's a *phpmyadmin* instance running on `http://localhost:6060/`,

View File

@ -38,3 +38,30 @@ This request will return you the session data with an `userId` and a `token`. Yo
If you don't pass the userId and token, a `NO_PERMISSION` error will be returned.
Additionally, if there are no users (only staff members), you can check a ticket you created by providing your email and the ticketNumber to the `/ticket/check` path. This path will return you a `token` and `ticketNumber` you will use to comment, retrieve, or do any other operations to the ticket.
## File Attachments
We have two settings for file attachment:
* *allow-attachments* setting flag indicates if users can attach files.
* *max-size* setting indicates what is the file size limit in MB.
When you want to attach images to a ticket, comment or article; you can place the string `IMAGE_PATH_i` inside the parameter `content`.
`IMAGE_PATH_i` indicates that it should be replaced with the path of the image of index `i` (zero-indexed).
You may also include the `images` parameter indicating the number of images; and `image_i` parameters, which contain the image file object of index `i`.
For example
```
/article/add
title = 'article title'
content = 'this is an article <img src="IMAGE_PATH_0"/> with two images <img src="IMAGE_PATH_1"/>'
position = 1
topicId = 1
images = 2
image_0 = <File>
image_1 = <File>
```
This request will upload `image_0` and `image_1`. After that, it will replace `IMAGE_PATH_0` and `IMAGE_PATH_1` with the corresponding urls for each image. The rest of the request will operate normal.
**Please remember that `max-size` setting applies also to images.**

View File

@ -37,3 +37,6 @@ db:
sh:
@docker exec -it opensupports-srv bash
doc:
@apidoc -i models/ -i data/ -i libs/ -i controllers/ -o apidoc/

View File

@ -1,82 +0,0 @@
/**
* @api {post} /staff/get Get staff
* @apiVersion 4.0.0
*
* @apiName Get staff
*
* @apiGroup Staff
*
* @apiDescription This path retrieves information about a staff member.
*
* @apiPermission staff1
*
* @apiParam {Number} staffId The id of the staff member to be searched.
*
* @apiUse NO_PERMISSION
*
* @apiSuccess {Object} data Information about a staff member
* @apiSuccess {String} data.name Staff id
* @apiSuccess {String} data.email Staff id
* @apiSuccess {String} data.profilePic Staff id
* @apiSuccess {Number} data.level Staff id
* @apiSuccess {Boolean} data.staff Staff id
* @apiSuccess {[Department](#api-Data_Structures-ObjectDepartment)[]} data.departments Array of departments that has assigned.
* @apiSuccess {[Ticket](#api-Data_Structures-ObjectTicket)[]} data.tickets Array of tickets that has assigned.
*
*/
/**
* @api {get} /system/download Download file
* @apiVersion 4.0.0
*
* @apiName Download file
*
* @apiGroup System
*
* @apiDescription This path downloads a file.
*
* @apiPermission any
*
* @apiParam {String} file The filename to be downloaded.
*
*
* @apiSuccess {Object} file File content
*
*/
/**
* @api {post} /system/init-settings Init settings
* @apiVersion 4.0.0
*
* @apiName Init settings
*
* @apiGroup System
*
* @apiDescription This path sets the initial settings. It can only be used once during installation.
*
* @apiPermission any
*
* @apiParam {String} language Indicates the default language of the system.
* @apiParam {String} user-system-enabled Indicates if the user system should be enabled.
* @apiParam {String} registration Indicates if the registration should be enabled.
*
* @apiUse INVALID_LANGUAGE
* @apiUse INIT_SETTINGS_DONE
*
* @apiSuccess {Object} data Empty object
*
*/
/**
* @api {OBJECT} Staff Staff
* @apiVersion 4.0.0
* @apiGroup Data Structures
* @apiParam {String} name Name of the staff member.
* @apiParam {String} email Email of the staff member.
* @apiParam {String} profilePic profilePic url of the staff member.
* @apiParam {Number} level Level of the staff member.
* @apiParam {Object[]} departments The departments the staff member has assigned.
* @apiParam {[Ticket](#api-Data_Structures-ObjectTicket)[]} tickets The tickets the staff member has assigned.
* @apiParam {Number} lastLogin The last login of the staff member.
*/

View File

@ -1,10 +1,10 @@
{
"name": "OpenSupports API Documentation",
"version": "4.1.0",
"version": "4.3.0",
"title": "OpenSupports API Documentation",
"description": "Backend API documentation for developers.",
"header": {
"title": "API Standards",
"filename": "API_STANDARD.md"
}
}
}

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /article/add-topic Add topic
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Add topic
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /article/add Add article
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Add article
*
@ -18,11 +18,14 @@ DataValidator::with('CustomValidations', true);
* @apiParam {String} content Content of the new article.
* @apiParam {Number} position Position of the new article.
* @apiParam {Number} topicId Id of the articles's topic.
* @apiParam {Number} images The number of images in the content
* @apiParam image_i The image file of index `i` (mutiple params accepted)
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_NAME
* @apiUse INVALID_CONTENT
* @apiUse INVALID_TOPIC
* @apiUse INVALID_FILE
*
* @apiSuccess {Object} data Article info
* @apiSuccess {Number} data.articleId Article id
@ -57,7 +60,7 @@ class AddArticleController extends Controller {
$fileUploader = FileUploader::getInstance();
$fileUploader->setPermission(FileManager::PERMISSION_ARTICLE);
$imagePaths = $this->uploadImages();
$imagePaths = $this->uploadImages(true);
$article = new Article();
$article->setProperties([

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /article/delete-topic Delete topic
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Delete topic
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /article/delete Delete article
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Delete article
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /article/edit-topic Edit topic
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Edit topic
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /article/edit Edit article
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Edit a article
*
@ -19,9 +19,12 @@ DataValidator::with('CustomValidations', true);
* @apiParam {String} content The new content of the article. Optional.
* @apiParam {String} title The new title of the article. Optional.
* @apiParam {Number} position The new position of the article. Optional.
* @apiParam {Number} images The number of images in the content
* @apiParam image_i The image file of index `i` (mutiple params accepted)
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_TOPIC
* @apiUse INVALID_FILE
*
* @apiSuccess {Object} data Empty object
*
@ -62,7 +65,7 @@ class EditArticleController extends Controller {
$fileUploader->setPermission(FileManager::PERMISSION_ARTICLE);
$content = Controller::request('content', true);
$imagePaths = $this->uploadImages();
$imagePaths = $this->uploadImages(true);
$article->content = $this->replaceWithImagePaths($imagePaths, $content);
}

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /article/get-all Get all articles
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get all articles
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /staff/add Add staff
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Add staff
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /staff/assign-ticket Assign ticket
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Assign ticket
*

View File

@ -4,7 +4,7 @@ use RedBeanPHP\Facade as RedBean;
/**
* @api {post} /staff/delete Delete staff
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Delete staff
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /staff/edit Edit staff
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Edit staff
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /staff/get-all-tickets Get all tickets
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get all tickets
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /staff/get-all Get all staffs
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get all staffs
*

View File

@ -4,7 +4,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /staff/get-new-tickets Get new tickets
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get new tickets
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /staff/get-tickets Get tickets
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get tickets
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /staff/get Get staff
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get staff
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /staff/last-events Get last events
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get last events
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /staff/search-tickets Search tickets
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Search tickets
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /staff/un-assign-ticket Un-assign ticket
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Un-assign ticket
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/add-api-key Add APIKey
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Add APIKey
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/add-department Add department
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Add department
*

View File

@ -3,7 +3,7 @@ use Ifsnop\Mysqldump as IMysqldump;
/**
* @api {post} /system/backup-database Backup database
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Backup database
*

View File

@ -2,7 +2,7 @@
/**
* @api {post} /system/check-requirements Checks requirements
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Check requirements
*

View File

@ -2,7 +2,7 @@
/**
* @api {post} /system/csv-import CSV import
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName CSV import
*

View File

@ -3,7 +3,7 @@ use RedBeanPHP\Facade as RedBean;
/**
* @api {post} /system/delete-all-users Delete all users
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Delete all users
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/delete-api-key Delete APIKey
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Delete APIKey
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /system/delete-department Delete department
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Delete department
*

View File

@ -2,7 +2,7 @@
/**
* @api {post} /system/disable-registration Disable registration
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Disable registration
*

View File

@ -2,7 +2,7 @@
/**
* @api {post} /system/disable-user-system Disable user system
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Disable user system
*

View File

@ -4,7 +4,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {get} /system/download Download file
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Download file
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /system/edit-department Edit department
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Edit department
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/edit-mail-template Edit mail template
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Edit mail template
*

View File

@ -2,7 +2,7 @@
/**
* @api {post} /system/edit-settings Edit settings
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Edit settings
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/enable-registration Enable registration
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Enable registration
*

View File

@ -2,7 +2,7 @@
/**
* @api {post} /system/enable-user-system Enable user system
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Enable user system
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/get-api-keys Get APIKeys
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get APIKeys
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/get-logs Get logs
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get logs
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/get-mail-templates Get mail templates
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get mail templates
*

View File

@ -2,7 +2,7 @@
/**
* @api {post} /system/get-settings Get settings
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get settings
*

View File

@ -4,7 +4,7 @@ use RedBeanPHP\Facade as RedBean;
/**
* @api {post} /system/get-stats Get stats
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get stats
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /system/init-admin Init admin
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Init admin
*

View File

@ -4,7 +4,7 @@ use RedBeanPHP\Facade as RedBean;
/**
* @api {post} /system/init-database Init database
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Init database
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /system/init-settings Init settings
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Init settings
*

View File

@ -3,7 +3,7 @@ use RedBeanPHP\Facade as RedBean;
/**
* @api {post} /system/installation-done Installation done
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Installation done
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/recover-mail-template Recover mail template
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Recover mail template
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/test-smtp Test SMTP Connection
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Test SMTP Connection
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/add-custom-response Add custom responses
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Add a custom response
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/change-department Change department
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Change department
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /ticket/change-priority Change priority
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Change priority
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/check Check ticket
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Check ticket
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/close Close ticket
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Close
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/comment Comment ticket
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Comment ticket
*
@ -16,11 +16,15 @@ DataValidator::with('CustomValidations', true);
*
* @apiParam {String} content Content of the comment.
* @apiParam {Number} ticketNumber The number of the ticket to comment.
* @apiParam {Number} images The number of images in the content
* @apiParam image_i The image file of index `i` (mutiple params accepted)
* @apiParam file The file you with to upload.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_CONTENT
* @apiUse INVALID_TICKET
* @apiUse INVALID_TOKEN
* @apiUse INVALID_FILE
*
* @apiSuccess {Object} data Empty object
*
@ -107,8 +111,8 @@ class CommentController extends Controller {
private function storeComment() {
$fileUploader = FileUploader::getInstance();
$fileUploader->setPermission(FileManager::PERMISSION_TICKET, $this->ticket->ticketNumber);
$imagePaths = $this->uploadImages();
$fileUploader = $this->uploadFile();
$imagePaths = $this->uploadImages(Controller::isStaffLogged());
$fileUploader = $this->uploadFile(Controller::isStaffLogged());
$comment = Ticketevent::getEvent(Ticketevent::COMMENT);
$comment->setProperties(array(

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/create Create ticket
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Create ticket
*
@ -19,15 +19,18 @@ DataValidator::with('CustomValidations', true);
* @apiParam {Number} departmentId The id of the department of the current ticket.
* @apiParam {String} language The language of the ticket.
* @apiParam {String} email The email of the user who created the ticket.
* @apiParam {String} name The Name of the author of the ticket.
* @apiParam {Number} images The number of images in the content
* @apiParam image_i The image file of index `i` (mutiple params accepted)
* @apiParam file The file you with to upload.
*
* @apiUse NO_PERMISSION$ticketNumber
* @apiUse NO_PERMISSION
* @apiUse INVALID_TITLE
* @apiUse INVALID_CONTENT
* @apiUse INVALID_DEPARTMENT
* @apiUse INVALID_LANGUAGE
* @apiUse INVALID_CAPTCHA
* @apiUse INVALID_EMAIL
* @apiUse INVALID_FILE
*
* @apiSuccess {Object} data Information of the new ticket
* @apiSuccess {Number} data.ticketNumber Number of the new ticket
@ -123,8 +126,8 @@ class CreateController extends Controller {
$fileUploader = FileUploader::getInstance();
$fileUploader->setPermission(FileManager::PERMISSION_TICKET, $ticket->generateUniqueTicketNumber());
$imagePaths = $this->uploadImages();
$fileUploader = $this->uploadFile();
$imagePaths = $this->uploadImages(Controller::isStaffLogged());
$fileUploader = $this->uploadFile(Controller::isStaffLogged());
$ticket->setProperties(array(
'title' => $this->title,

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/delete-custom-response Delete custom response
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Delete custom response
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/edit-custom-response Edit custom response
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Edit custom response
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/get-custom-responses Get custom responses
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get custom responses
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/get Get ticket
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get ticket
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /ticket/re-open Reopen ticket
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Reopen ticket
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /ticket/seen See ticket
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName See ticket
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/ban Ban email
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Ban email
*

View File

@ -2,7 +2,7 @@
/**
* @api {post} /user/check-session Check session
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Check session
*

View File

@ -4,7 +4,7 @@ use RedBeanPHP\Facade as RedBean;
/**
* @api {post} /user/delete Delete user
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Delete user
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/edit-email Edit email
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Edit email
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/edit-password Edit password
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Edit password
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /user/get-user Get user information
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get user information
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/get-users Get users list
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get users list
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /user/get Get my information
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get my Information
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/list-ban Get ban list
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Get ban list
*

View File

@ -2,7 +2,7 @@
/**
* @api {post} /user/login Login
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Login
*

View File

@ -1,7 +1,7 @@
<?php
/**
* @api {post} /user/logout Log out
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Log out
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /user/recover-password Recover password
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Recover password
*

View File

@ -4,7 +4,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /user/send-recover-password Send password recovery
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Send password recovery
*

View File

@ -5,7 +5,7 @@ DataValidator::with('CustomValidations', true);
/**
* @api {post} /user/signup Sign up
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Sign up
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/un-ban Un ban
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Un ban
*

View File

@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/verify Verify email
* @apiVersion 4.2.0
* @apiVersion 4.3.0
*
* @apiName Verify email
*

View File

@ -161,7 +161,7 @@
*/
/**
* @apiDefine INVALID_FILE
* @apiError {String} INVALID_FILE The file is invalid.
* @apiError {String} INVALID_FILE The file is invalid or max size exceeded.
*/
/**
* @apiDefine DATABASE_CONNECTION

View File

@ -95,11 +95,12 @@ abstract class Controller {
return \Slim\Slim::getInstance();
}
public function uploadImages() {
public function uploadImages($forceUpload = false) {
$allowAttachments = Setting::getSetting('allow-attachments')->getValue();
$totalImages = Controller::request('images') * 1;
if(!$totalImages || (!$allowAttachments && !$forceUpload)) return '';
if(!$allowAttachments && !$forceUpload) return [];
if(!$totalImages) return [];
$maxSize = Setting::getSetting('max-size')->getValue();
$fileGap = Setting::getSetting('file-gap')->getValue();
@ -133,7 +134,8 @@ abstract class Controller {
public function uploadFile($forceUpload = false) {
$allowAttachments = Setting::getSetting('allow-attachments')->getValue();
if(!isset($_FILES['file']) || (!$allowAttachments && !$forceUpload)) return '';
if(!$allowAttachments && !$forceUpload) return '';
if(!isset($_FILES['file'])) return '';
$maxSize = Setting::getSetting('max-size')->getValue();
$fileGap = Setting::getSetting('file-gap')->getValue();

View File

@ -1,7 +1,7 @@
<?php
/**
* @api {OBJECT} APIKey APIKey
* @apiVersion 4.2.0
* @apiVersion 4.3.0
* @apiGroup Data Structures
* @apiParam {String} name Name of the APIKey.
* @apiParam {String} token Token of the APIKey.

View File

@ -1,7 +1,7 @@
<?php
/**
* @api {OBJECT} Article Article
* @apiVersion 4.2.0
* @apiVersion 4.3.0
* @apiGroup Data Structures
* @apiParam {Number} id Id of the article.
* @apiParam {String} title Title of the article.

View File

@ -1,7 +1,7 @@
<?php
/**
* @api {OBJECT} Ban Ban
* @apiVersion 4.2.0
* @apiVersion 4.3.0
* @apiGroup Data Structures
* @apiParam {Email} email The email address that is banned.
*/

View File

@ -1,7 +1,7 @@
<?php
/**
* @api {OBJECT} CustomResponse CustomResponse
* @apiVersion 4.2.0
* @apiVersion 4.3.0
* @apiGroup Data Structures
* @apiParam {Number} id Id of the custom response.
* @apiParam {String} content Content of the custom response.

View File

@ -3,7 +3,7 @@ use RedBeanPHP\Facade as RedBean;
/**
* @api {OBJECT} Department Department
* @apiVersion 4.2.0
* @apiVersion 4.3.0
* @apiGroup Data Structures
* @apiParam {Number} id Id of the department.
* @apiParam {String} name Name of the department.

View File

@ -2,7 +2,7 @@
use RedBeanPHP\Facade as RedBean;
/**
* @api {OBJECT} Log Log
* @apiVersion 4.2.0
* @apiVersion 4.3.0
* @apiGroup Data Structures
* @apiParam {String} type The type of the log.
* @apiParam {String} to Object where the action was performed.

View File

@ -3,7 +3,7 @@ use RedBeanPHP\Facade as RedBean;
/**
* @api {OBJECT} MailTemplate MailTemplate
* @apiVersion 4.2.0
* @apiVersion 4.3.0
* @apiGroup Data Structures
* @apiParam {String} type The type of the mail template.
* @apiParam {String} subject The subject of the mail template.

View File

@ -1,7 +1,7 @@
<?php
/**
* @api {OBJECT} Staff Staff
* @apiVersion 4.2.0
* @apiVersion 4.3.0
* @apiGroup Data Structures
* @apiParam {String} name Name of the staff member.
* @apiParam {String} email Email of the staff member.

View File

@ -1,7 +1,7 @@
<?php
/**
* @api {OBJECT} Stat Stat
* @apiVersion 4.2.0
* @apiVersion 4.3.0
* @apiGroup Data Structures
* @apiParam {Number} date The date of the stat as a number in format YYYYMMDD.
* @apiParam {String} type The type of the stat. It can be CREATE_TICKET, CLOSE, SIGNUP, COMMENT, ASSIGN or UNASSIGN

View File

@ -1,7 +1,7 @@
<?php
/**
* @api {OBJECT} Ticket Ticket
* @apiVersion 4.2.0
* @apiVersion 4.3.0
* @apiGroup Data Structures
* @apiParam {Number} ticketNumber The number of the ticket.
* @apiParam {String} title The title of the ticket.

View File

@ -1,7 +1,7 @@
<?php
/**
* @api {OBJECT} TicketEvent TicketEvent
* @apiVersion 4.2.0
* @apiVersion 4.3.0
* @apiGroup Data Structures
* @apiParam {String} type The type of the ticket event. It can be COMMENT, ASSIGN, UN_ASSIGN, CLOSE, RE_OPEN, DEPARTMENT_CHANGED or PRIORITY_CHANGED
* @apiParam {String} content The content of the ticket event.

View File

@ -1,7 +1,7 @@
<?php
/**
* @api {OBJECT} Topic Topic
* @apiVersion 4.2.0
* @apiVersion 4.3.0
* @apiGroup Data Structures
* @apiParam {Number} id Id of the topic.
* @apiParam {String} name Name of the topic.

View File

@ -3,7 +3,7 @@ use RedBeanPHP\Facade as RedBean;
/**
* @api {OBJECT} User User
* @apiVersion 4.2.0
* @apiVersion 4.3.0
* @apiGroup Data Structures
* @apiParam {String} email The email of the user.
* @apiParam {Number} id The id of the user.