RICADO Gen 4 API JS Client

RICADO Gen 4 API JS Client

source

Controllers/ToolsController.js

/**
 * File Auto-Generated by the RICADO Gen 4 PHP API Project
 * 
 * Do Not Edit this File Manually!
 */

import RequestHelper from '../RequestHelper';

/**
 * The Tools Controller Class
 * 
 * @class
 */
class ToolsController
{
    /**
     * Ping the API Server [GET /ping]
     * 
     * Sends a 'Ping' Request to the Server of which the Server will respond with 'Pong'. Authentication is not required to make this API call.
     * 
     * @static
     * @public
     * @return {Promise<string>}
     */
    static ping()
    {
        return new Promise((resolve, reject) => {
            RequestHelper.getRequest(`/ping`)
            .then((result) => {
                let resolveValue = (function(){
                    if(typeof result !== 'string')
                    {
                        return String(result);
                    }
                
                    return result;
                }());
                
                resolve(resolveValue);
            })
            .catch(error => reject(error));
        });
    }
}

export default ToolsController;