Ivan - Add error documentation

This commit is contained in:
ivan 2017-04-20 00:55:38 -03:00
parent 2b50c7a106
commit b985d02f1b
5 changed files with 227 additions and 13 deletions

View File

@ -3,13 +3,13 @@ use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/add-custom-response Add new responses.
* @api {post} /ticket/add-custom-response Add new custom responses.
*
* @apiName Add custom response
* @apiName Add a custom response
*
* @apiGroup Ticket
*
* @apiDescription This path allows create new responses to tickets.
* @apiDescription This path allows create new custom responses for tickets.
*
* @apiPermission Staff Level 2
*
@ -19,9 +19,11 @@ DataValidator::with('CustomValidations', true);
*
* @apiParam {String} language Language of the response.
*
* @apiError {String} message
* @apiUse INVALID_NAME
* @apiUse INVALID_CONTENT
* @apiUse INVALID_LANGUAGE
*
* @apiSuccess {Object} data
* @apiSuccess {Object} data Empty object
*
*/

View File

@ -1,28 +1,28 @@
<?php
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/get give back information about a ticket.
* @api {post} /ticket/get Retrieve Ticket information.
*
* @apiName Get
* @apiName GetTicket
*
* @apiGroup Ticket
*
* @apiDescription This path give back information about a ticket.
* @apiDescription This path gives back information about a ticket.
*
* @apiPermission any
*
* @apiParam {number} ticketNumber The number of the ticket.
*
* @apiParam {string} csrf_token Token of the session.
* @apiParam {string} csrf_token Token of the current session.
*
* @apiError {String} message
*
* @apiSuccess {Object} data
* @apiUse NO_PERMISSION
* @apiUse INVALID_TICKET
*
* @apiSuccess {[Ticket](#api-Data_Structures-ObjectTicket)} events The requested event(s).
*/
class TicketGetController extends Controller {
const PATH = '/get';
const METHOD = 'POST';

View File

@ -1,4 +1,177 @@
<?php
/**
* @apiDefine INVALID_CREDENTIALS
* @apiError {String} INVALID_CREDENTIALS Login credentials does not match.
*/
/**
* @apiDefine SESSION_EXISTS
* @apiError {String} SESSION_EXISTS The session already exists.
*/
/**
* @apiDefine USER_EXISTS
* @apiError {String} USER_EXISTS The user already exists.
*/
/**
* @apiDefine NO_PERMISSION
* @apiError {String} NO_PERMISSION You have no permission to perform this operation.
*/
/**
* @apiDefine INVALID_TITLE
* @apiError {String} INVALID_TITLE The title is invalid, probably too short.
*/
/**
* @apiDefine INVALID_CONTENT
* @apiError {String} INVALID_CONTENT The content is invalid, probably to short.
*/
/**
* @apiDefine INVALID_EMAIL
* @apiError {String} INVALID_EMAIL The email is invalid or already exists.
*/
/**
* @apiDefine INVALID_PASSWORD
* @apiError {String} INVALID_PASSWORD The password is invalid, probably too short.
*/
/**
* @apiDefine INVALID_NAME
* @apiError {String} INVALID_NAME Common error
*/
/**
* @apiDefine INVALID_SETTING
* @apiError {String} INVALID_SETTING Common error
*/
/**
* @apiDefine INVALID_DEPARTMENT
* @apiError {String} INVALID_DEPARTMENT Common error
*/
/**
* @apiDefine INVALID_TICKET
* @apiError {String} INVALID_TICKET Common error
*/
/**
* @apiDefine INIT_SETTINGS_DONE
* @apiError {String} INIT_SETTINGS_DONE Common error
*/
/**
* @apiDefine INVALID_OLD_PASSWORD
* @apiError {String} INVALID_OLD_PASSWORD Common error
*/
/**
* @apiDefine INVALID_CAPTCHA
* @apiError {String} INVALID_CAPTCHA Common error
*/
/**
* @apiDefine INVALID_TICKET_EVENT
* @apiError {String} INVALID_TICKET_EVENT Common error
*/
/**
* @apiDefine INVALID_LANGUAGE
* @apiError {String} INVALID_LANGUAGE Common error
*/
/**
* @apiDefine TICKET_ALREADY_ASSIGNED
* @apiError {String} TICKET_ALREADY_ASSIGNED Common error
*/
/**
* @apiDefine INVALID_PRIORITY
* @apiError {String} INVALID_PRIORITY Common error
*/
/**
* @apiDefine INVALID_PAGE
* @apiError {String} INVALID_PAGE Common error
*/
/**
* @apiDefine INVALID_QUERY
* @apiError {String} INVALID_QUERY Common error
*/
/**
* @apiDefine INVALID_TOPIC
* @apiError {String} INVALID_TOPIC Common error
*/
/**
* @apiDefine INVALID_SEARCH
* @apiError {String} INVALID_SEARCH Common error
*/
/**
* @apiDefine INVALID_ORDER
* @apiError {String} INVALID_ORDER Common error
*/
/**
* @apiDefine INVALID_USER
* @apiError {String} INVALID_USER Common error
*/
/**
* @apiDefine ALREADY_BANNED
* @apiError {String} ALREADY_BANNED Common error
*/
/**
* @apiDefine INVALID_LEVEL
* @apiError {String} INVALID_LEVEL Common error
*/
/**
* @apiDefine ALREADY_A_STAFF
* @apiError {String} ALREADY_A_STAFF Common error
*/
/**
* @apiDefine INVALID_STAFF
* @apiError {String} INVALID_STAFF Common error
*/
/**
* @apiDefine SAME_DEPARTMENT
* @apiError {String} SAME_DEPARTMENT Common error
*/
/**
* @apiDefine INVALID_TOKEN
* @apiError {String} INVALID_TOKEN Common error
*/
/**
* @apiDefine UNVERIFIED_USER
* @apiError {String} UNVERIFIED_USER Common error
*/
/**
* @apiDefine INVALID_TEMPLATE
* @apiError {String} INVALID_TEMPLATE Common error
*/
/**
* @apiDefine INVALID_SUBJECT
* @apiError {String} INVALID_SUBJECT Common error
*/
/**
* @apiDefine INVALID_BODY
* @apiError {String} INVALID_BODY Common error
*/
/**
* @apiDefine USER_SYSTEM_DISABLED
* @apiError {String} USER_SYSTEM_DISABLED Common error
*/
/**
* @apiDefine SYSTEM_USER_IS_ALREADY_DISABLED
* @apiError {String} SYSTEM_USER_IS_ALREADY_DISABLED Common error
*/
/**
* @apiDefine SYSTEM_USER_IS_ALREADY_ENABLED
* @apiError {String} SYSTEM_USER_IS_ALREADY_ENABLED Common error
*/
/**
* @apiDefine INVALID_PERIOD
* @apiError {String} INVALID_PERIOD Common error
*/
/**
* @apiDefine NAME_ALREADY_USED
* @apiError {String} NAME_ALREADY_USED Common error
*/
/**
* @apiDefine INVALID_FILE
* @apiError {String} INVALID_FILE Common error
*/
/**
* @apiDefine DATABASE_CONNECTION
* @apiError {String} DATABASE_CONNECTION Common error
*/
/**
* @apiDefine DATABASE_CREATION
* @apiError {String} DATABASE_CREATION Common error
*/
class ERRORS {
const INVALID_CREDENTIALS = 'INVALID_CREDENTIALS';
const SESSION_EXISTS = 'SESSION_EXISTS';

View File

@ -1,4 +1,29 @@
<?php
/**
* @api {OBJECT} Ticket Ticket
* @apiGroup Data Structures
* @apiParam {Number} ticketNumber Users age.
* @apiParam {String} title Avatar-Image.
* @apiParam {String} content Avatar-Image.
* @apiParam {Object} department Avatar-Image.
* @apiParam {Number} department.id Avatar-Image.
* @apiParam {String} department.name Avatar-Image.
* @apiParam {String} file Avatar-Image.
* @apiParam {String} language Avatar-Image.
* @apiParam {Boolean} unread Avatar-Image.
* @apiParam {Boolean} unreadStaff Avatar-Image.
* @apiParam {Boolean} closed Avatar-Image.
* @apiParam {String} priority Avatar-Image.
* @apiParam {Object} author Avatar-Image.
* @apiParam {Number} author.id Avatar-Image.
* @apiParam {String} author.name Avatar-Image.
* @apiParam {String} author.email Avatar-Image.
* @apiParam {Object} owner Avatar-Image.
* @apiParam {Number} owner.id Avatar-Image.
* @apiParam {String} owner.name Avatar-Image.
* @apiParam {String} owner.email Avatar-Image.
* @apiParam {[TicketEvent](#api-Data_Structures-ObjectTicketevent)[]} events The requested event(s).
*/
use RedBeanPHP\Facade as RedBean;
class Ticket extends DataStore {

View File

@ -1,4 +1,18 @@
<?php
/**
* @api {OBJECT} TicketEvent TicketEvent
* @apiGroup Data Structures
* @apiParam {String} type Avatar-Image.
* @apiParam {String} content Avatar-Image.
* @apiParam {Object} author Avatar-Image.
* @apiParam {Number} author.id Avatar-Image.
* @apiParam {String} author.name Avatar-Image.
* @apiParam {String} author.email Avatar-Image.
* @apiParam {String} author.profilePic Avatar-Image.
* @apiParam {Boolean} author.staff Avatar-Image.
* @apiParam {String} date Avatar-Image.
* @apiParam {String} file Avatar-Image.
*/
class Ticketevent extends DataStore {
const TABLE = 'ticketevent';